public function ExecManagerTest::testExecManagerTimeout in ImageMagick 8.3
Same name and namespace in other branches
- 8.2 tests/src/Kernel/ExecManagerTest.php \Drupal\Tests\imagemagick\Kernel\ExecManagerTest::testExecManagerTimeout()
Test timeout on ExecManager.
File
- tests/
src/ Kernel/ ExecManagerTest.php, line 34
Class
- ExecManagerTest
- Tests for ImagemagickExecManager.
Namespace
Drupal\Tests\imagemagick\KernelCode
public function testExecManagerTimeout() : void {
$exec_manager = \Drupal::service('imagemagick.exec_manager');
$output = '';
$error = '';
$expected = substr(PHP_OS, 0, 3) !== 'WIN' ? 143 : 1;
// Set a short timeout (1 sec.) and run a process that is expected to last
// longer (10 secs.). Should return a 'terminate' exit code.
$exec_manager
->setTimeout(1);
$ret = $exec_manager
->runOsShell('sleep', '10', 'sleep', $output, $error);
$this
->assertEquals($expected, $ret, $error);
}