Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MinificationFilenameResolverTest.php
Go to the documentation of this file.
1 <?php
7 
10 
16 class MinificationFilenameResolverTest extends \PHPUnit\Framework\TestCase
17 {
27  public function testResolve($isMin, $input, $expected)
28  {
29  $minificationMock = $this->getMockBuilder(Minification::class)
30  ->disableOriginalConstructor()
31  ->getMock();
32 
33  $minificationMock->expects(self::once())
34  ->method('isEnabled')
35  ->with('ext')
36  ->willReturn($isMin);
37 
38  $resolver = new MinificationFilenameResolver($minificationMock);
39 
40  self::assertEquals($expected, $resolver->resolve($input));
41  }
42 
46  public function dataProviderForTestResolve()
47  {
48  return [
49  [
50  'isMin' => true,
51  'input' => 'test.min.ext',
52  'expected' => 'test.ext'
53  ],
54  [
55  'isMin' => false,
56  'input' => 'test.min.ext',
57  'expected' => 'test.min.ext'
58  ],
59  [
60  'isMin' => false,
61  'input' => 'test.ext',
62  'expected' => 'test.ext'
63  ]
64  ];
65  }
66 }