ExecManagerTest.php in ImageMagick 8.3
File
tests/src/Kernel/ExecManagerTest.php
View source
<?php
namespace Drupal\Tests\imagemagick\Kernel;
use Drupal\KernelTests\KernelTestBase;
class ExecManagerTest extends KernelTestBase {
protected static $modules = [
'imagemagick',
'file_mdm',
'sophron',
];
public function testExecManagerCommandNotFound() : void {
$exec_manager = \Drupal::service('imagemagick.exec_manager');
$output = '';
$error = '';
$expected = substr(PHP_OS, 0, 3) !== 'WIN' ? 127 : 1;
$ret = $exec_manager
->runOsShell('pinkpanther', '-inspector Clouseau', 'blake', $output, $error);
$this
->assertEquals($expected, $ret, $error);
}
public function testExecManagerTimeout() : void {
$exec_manager = \Drupal::service('imagemagick.exec_manager');
$output = '';
$error = '';
$expected = substr(PHP_OS, 0, 3) !== 'WIN' ? 143 : 1;
$exec_manager
->setTimeout(1);
$ret = $exec_manager
->runOsShell('sleep', '10', 'sleep', $output, $error);
$this
->assertEquals($expected, $ret, $error);
}
}