BinaryTestCase.php in Image Optimize Binaries 8
File
tests/src/Unit/BinaryTestCase.php
View source
<?php
namespace Drupal\Tests\imageapi_optimize_binaries\Unit;
use Drupal\Tests\UnitTestCase;
abstract class BinaryTestCase extends UnitTestCase {
protected function getLoggerMock() {
return $this
->createMock('\\Psr\\Log\\LoggerInterface');
}
protected function getImageFactoryMock() {
return $this
->getMockBuilder('\\Drupal\\Core\\Image\\ImageFactory')
->disableOriginalConstructor()
->getMock();
}
protected function getFileSystemMock() {
$fileSystemMock = $this
->createMock('\\Drupal\\Core\\File\\FileSystemInterface');
$fileSystemMock
->method('realpath')
->will($this
->returnArgument(0));
return $fileSystemMock;
}
protected function getShellOperationsMock() {
$shellOperationsMock = $this
->getMockBuilder('\\Drupal\\imageapi_optimize_binaries\\ImageAPIOptimizeShellOperationsInterface')
->setMethods([
'findExecutablePath',
'execShellCommand',
'saveCommandStdoutToFile',
])
->getMock();
$shellOperationsMock
->method('findExecutablePath')
->will($this
->returnArgument(0));
return $shellOperationsMock;
}
}