public function AdvPngTest::testPNGOptimized in Image Optimize Binaries 8
@dataProvider advpngProvider
File
- tests/
src/ Unit/ AdvPngTest.php, line 56  
Class
- AdvPngTest
 - Tests AdvPng image optimize plugin.
 
Namespace
Drupal\Tests\imageapi_optimize_binaries\UnitCode
public function testPNGOptimized($config, $options) {
  $loggerMock = $this
    ->getLoggerMock();
  $imageFactoryMock = $this
    ->getImageFactoryMock();
  $fileSystemMock = $this
    ->getFileSystemMock();
  $shellOperationsMock = $this
    ->getShellOperationsMock();
  $advpng = new AdvPng([
    'data' => $config,
  ], 'advpng', [], $loggerMock, $imageFactoryMock, $fileSystemMock, $shellOperationsMock);
  $imagePNGMock = $this
    ->createMock('\\Drupal\\Core\\Image\\ImageInterface');
  $imagePNGMock
    ->method('getMimeType')
    ->willReturn('image/png');
  $imageFactoryMock
    ->method('get')
    ->willReturn($imagePNGMock);
  $shellOperationsMock
    ->expects($this
    ->once())
    ->method('execShellCommand')
    ->with($this
    ->equalTo('advpng'), $this
    ->identicalTo($options), $this
    ->identicalTo([
    'public://test_image.png',
  ]));
  $advpng
    ->applyToImage('public://test_image.png');
}