public function AdvDefTest::testPNGOptimized in Image Optimize Binaries 8
@dataProvider advdefProvider
File
- tests/
src/ Unit/ AdvDefTest.php, line 56
Class
- AdvDefTest
- Tests AdvDef 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();
$advdef = new AdvDef([
'data' => $config,
], 'advdef', [], $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('advdef'), $this
->identicalTo($options), $this
->identicalTo([
'public://test_image.png',
]));
$advdef
->applyToImage('public://test_image.png');
}