Merge branch '2.3' into 2.4

* 2.3:
  [Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails
  [Process] Fix some unit tests that create the process object instead of delegate it to the implementation
  [Process] Make process tests more accurate on exception messages
  [Process] Fix process status in TTY mode
  [Process] Use assertSame instead of assertEquals to avoid comparison against `null`
  [HttpFoundation] added some unit tests
  10158 get vary multiple
  made Cookie stringification more robust
  [Yaml] fix for a HHVM bug
This commit is contained in:
Fabien Potencier 2014-03-12 19:29:58 +01:00
commit 76fbd89e02
12 changed files with 97 additions and 27 deletions

View File

@ -96,7 +96,7 @@ class Cookie
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires); throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires);
} }
$cookie .= '; expires='.substr($dateTime->format(self::$dateFormats[0]), 0, -5); $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
} }
if ('' !== $this->domain) { if ('' !== $this->domain) {

View File

@ -1048,11 +1048,16 @@ class Response
*/ */
public function getVary() public function getVary()
{ {
if (!$vary = $this->headers->get('Vary')) { if (!$vary = $this->headers->get('Vary', null, false)) {
return array(); return array();
} }
return is_array($vary) ? $vary : preg_split('/[\s,]+/', $vary); $ret = array();
foreach ($vary as $item) {
$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
}
return $ret;
} }
/** /**

View File

@ -341,6 +341,16 @@ class ResponseTest extends ResponseTestCase
$response = new Response(); $response = new Response();
$response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo'); $response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo');
$this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas'); $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas');
$vary = array('Accept-Language', 'User-Agent', 'X-foo');
$response = new Response();
$response->headers->set('Vary', $vary);
$this->assertEquals($vary, $response->getVary(), '->getVary() parses multiple header name values in arrays');
$response = new Response();
$response->headers->set('Vary', 'Accept-Language, User-Agent, X-foo');
$this->assertEquals($vary, $response->getVary(), '->getVary() parses multiple header name values in arrays');
} }
public function testSetVary() public function testSetVary()
@ -353,7 +363,7 @@ class ResponseTest extends ResponseTestCase
$this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default'); $this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default');
$response->setVary('X-Foo', false); $response->setVary('X-Foo', false);
$this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() doesn\'t change the Vary header if replace is set to false'); $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false');
} }
public function testDefaultContentType() public function testDefaultContentType()

View File

@ -304,7 +304,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
} }
} }
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5); $cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T'));
} }
if ($domain) { if ($domain) {

View File

@ -253,8 +253,6 @@ class Process
$this->processPipes->unblock(); $this->processPipes->unblock();
if ($this->tty) { if ($this->tty) {
$this->status = self::STATUS_TERMINATED;
return; return;
} }
@ -481,7 +479,7 @@ class Process
public function getExitCode() public function getExitCode()
{ {
if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) { if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method'); throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
} }
$this->updateStatus(false); $this->updateStatus(false);
@ -533,7 +531,7 @@ class Process
public function hasBeenSignaled() public function hasBeenSignaled()
{ {
if ($this->isSigchildEnabled()) { if ($this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved'); throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
} }
$this->updateStatus(false); $this->updateStatus(false);
@ -555,7 +553,7 @@ class Process
public function getTermSignal() public function getTermSignal()
{ {
if ($this->isSigchildEnabled()) { if ($this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved'); throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
} }
$this->updateStatus(false); $this->updateStatus(false);

View File

@ -52,6 +52,9 @@ class ProcessUtils
} elseif ('%' === $part) { } elseif ('%' === $part) {
$escapedArgument .= '^%'; $escapedArgument .= '^%';
} else { } else {
if ('\\' === substr($part, -1)) {
$part .= '\\';
}
$escapedArgument .= escapeshellarg($part); $escapedArgument .= escapeshellarg($part);
} }
} }

View File

@ -167,7 +167,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetErrorOutput() public function testGetErrorOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }'))); $p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
$p->run(); $p->run();
$this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches)); $this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches));
@ -175,7 +175,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetIncrementalErrorOutput() public function testGetIncrementalErrorOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { usleep(50000); file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }'))); $p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { usleep(50000); file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
$p->start(); $p->start();
while ($p->isRunning()) { while ($p->isRunning()) {
@ -195,7 +195,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetOutput() public function testGetOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) {echo \' foo \';$n++; usleep(500); }'))); $p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) {echo \' foo \';$n++; usleep(500); }')));
$p->run(); $p->run();
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches)); $this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
@ -203,7 +203,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetIncrementalOutput() public function testGetIncrementalOutput()
{ {
$p = new Process(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) { echo \' foo \'; usleep(50000); $n++; }'))); $p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n=0;while ($n<3) { echo \' foo \'; usleep(50000); $n++; }')));
$p->start(); $p->start();
while ($p->isRunning()) { while ($p->isRunning()) {
@ -242,11 +242,26 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
$process = $this->getProcess('echo "foo" >> /dev/null'); $process = $this->getProcess('echo "foo" >> /dev/null');
$process->setTTY(true); $process->setTTY(true);
$process->run(); $process->start();
$this->assertTrue($process->isRunning());
$process->wait();
$this->assertSame(Process::STATUS_TERMINATED, $process->getStatus()); $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
} }
public function testTTYCommandExitCode()
{
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->markTestSkipped('Windows does have /dev/tty support');
}
$process = $this->getProcess('echo "foo" >> /dev/null');
$process->setTTY(true);
$process->run();
$this->assertTrue($process->isSuccessful());
}
public function testExitCodeText() public function testExitCodeText()
{ {
$process = $this->getProcess(''); $process = $this->getProcess('');
@ -260,11 +275,12 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testStartIsNonBlocking() public function testStartIsNonBlocking()
{ {
$process = $this->getProcess('php -r "sleep(4);"'); $process = $this->getProcess('php -r "usleep(500000);"');
$start = microtime(true); $start = microtime(true);
$process->start(); $process->start();
$end = microtime(true); $end = microtime(true);
$this->assertLessThan(1 , $end-$start); $this->assertLessThan(0.2, $end-$start);
$process->wait();
} }
public function testUpdateStatus() public function testUpdateStatus()
@ -299,7 +315,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
{ {
$process = $this->getProcess('php -m'); $process = $this->getProcess('php -m');
$process->run(); $process->run();
$this->assertEquals(0, $process->getExitCode()); $this->assertSame(0, $process->getExitCode());
} }
public function testStatus() public function testStatus()
@ -351,10 +367,10 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testIsNotSuccessful() public function testIsNotSuccessful()
{ {
$process = $this->getProcess('php -r "sleep(4);"'); $process = $this->getProcess('php -r "usleep(500000);throw new \Exception(\'BOUM\');"');
$process->start(); $process->start();
$this->assertTrue($process->isRunning()); $this->assertTrue($process->isRunning());
$process->stop(); $process->wait();
$this->assertFalse($process->isSuccessful()); $this->assertFalse($process->isSuccessful());
} }
@ -472,7 +488,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testRunProcessWithTimeout() public function testRunProcessWithTimeout()
{ {
$timeout = 0.5; $timeout = 0.5;
$process = $this->getProcess('php -r "sleep(3);"'); $process = $this->getProcess('php -r "usleep(600000);"');
$process->setTimeout($timeout); $process->setTimeout($timeout);
$start = microtime(true); $start = microtime(true);
try { try {
@ -552,7 +568,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testStartAfterATimeout() public function testStartAfterATimeout()
{ {
$process = $this->getProcess('php -r "while (true) {echo \'\'; usleep(1000); }"'); $process = $this->getProcess('php -r "$n = 1000; while ($n--) {echo \'\'; usleep(1000); }"');
$process->setTimeout(0.1); $process->setTimeout(0.1);
try { try {
$process->run(); $process->run();
@ -567,10 +583,10 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
public function testGetPid() public function testGetPid()
{ {
$process = $this->getProcess('php -r "sleep(1);"'); $process = $this->getProcess('php -r "usleep(500000);"');
$process->start(); $process->start();
$this->assertGreaterThan(0, $process->getPid()); $this->assertGreaterThan(0, $process->getPid());
$process->stop(); $process->wait();
} }
public function testGetPidIsNullBeforeStart() public function testGetPidIsNullBeforeStart()

View File

@ -31,6 +31,7 @@ class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
array('^%"path"^%', '%path%'), array('^%"path"^%', '%path%'),
array('"<|>"\\"" "\\""\'f"', '<|>" "\'f'), array('"<|>"\\"" "\\""\'f"', '<|>" "\'f'),
array('""', ''), array('""', ''),
array('"with\trailingbs\\\\"', 'with\trailingbs\\'),
); );
} }
@ -39,6 +40,7 @@ class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
array("'%path%'", '%path%'), array("'%path%'", '%path%'),
array("'<|>\" \"'\\''f'", '<|>" "\'f'), array("'<|>\" \"'\\''f'", '<|>" "\'f'),
array("''", ''), array("''", ''),
array("'with\\trailingbs\\'", 'with\trailingbs\\'),
); );
} }
} }

View File

@ -15,6 +15,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
{ {
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testGetExitCode() public function testGetExitCode()
{ {
@ -23,6 +24,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testGetExitCodeIsNullOnStart() public function testGetExitCodeIsNullOnStart()
{ {
@ -31,6 +33,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testGetExitCodeIsNullOnWhenStartingAgain() public function testGetExitCodeIsNullOnWhenStartingAgain()
{ {
@ -39,6 +42,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testExitCodeCommandFailed() public function testExitCodeCommandFailed()
{ {
@ -47,6 +51,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage his PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessIsSignaledIfStopped() public function testProcessIsSignaledIfStopped()
{ {
@ -55,6 +60,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage his PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessWithTermSignal() public function testProcessWithTermSignal()
{ {
@ -63,6 +69,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage his PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessIsNotSignaled() public function testProcessIsNotSignaled()
{ {
@ -71,6 +78,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage his PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessWithoutTermSignal() public function testProcessWithoutTermSignal()
{ {
@ -79,6 +87,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testCheckTimeoutOnStartedProcess() public function testCheckTimeoutOnStartedProcess()
{ {
@ -87,6 +96,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
*/ */
public function testGetPid() public function testGetPid()
{ {
@ -95,6 +105,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
*/ */
public function testGetPidIsNullBeforeStart() public function testGetPidIsNullBeforeStart()
{ {
@ -103,6 +114,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
*/ */
public function testGetPidIsNullAfterRun() public function testGetPidIsNullAfterRun()
{ {
@ -111,6 +123,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testExitCodeText() public function testExitCodeText()
{ {
@ -122,6 +135,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testIsSuccessful() public function testIsSuccessful()
{ {
@ -130,6 +144,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testIsSuccessfulOnlyAfterTerminated() public function testIsSuccessfulOnlyAfterTerminated()
{ {
@ -138,6 +153,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/ */
public function testIsNotSuccessful() public function testIsNotSuccessful()
{ {
@ -146,6 +162,16 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
*/
public function testTTYCommandExitCode()
{
parent::testTTYCommandExitCode();
}
/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process can not be signaled.
*/ */
public function testSignal() public function testSignal()
{ {
@ -154,6 +180,7 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessWithoutTermSignalIsNotSignaled() public function testProcessWithoutTermSignalIsNotSignaled()
{ {

View File

@ -15,6 +15,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
{ {
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessIsSignaledIfStopped() public function testProcessIsSignaledIfStopped()
{ {
@ -23,6 +24,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessWithTermSignal() public function testProcessWithTermSignal()
{ {
@ -31,6 +33,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessIsNotSignaled() public function testProcessIsNotSignaled()
{ {
@ -39,6 +42,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessWithoutTermSignal() public function testProcessWithoutTermSignal()
{ {
@ -47,6 +51,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
*/ */
public function testGetPid() public function testGetPid()
{ {
@ -55,6 +60,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
*/ */
public function testGetPidIsNullBeforeStart() public function testGetPidIsNullBeforeStart()
{ {
@ -63,6 +69,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.
*/ */
public function testGetPidIsNullAfterRun() public function testGetPidIsNullAfterRun()
{ {
@ -79,6 +86,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. The process can not be signaled.
*/ */
public function testSignal() public function testSignal()
{ {
@ -87,6 +95,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
/** /**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.
*/ */
public function testProcessWithoutTermSignalIsNotSignaled() public function testProcessWithoutTermSignalIsNotSignaled()
{ {

View File

@ -95,7 +95,7 @@ EOF;
} elseif (isset($test['todo']) && $test['todo']) { } elseif (isset($test['todo']) && $test['todo']) {
// TODO // TODO
} else { } else {
$expected = eval('return '.trim($test['php']).';'); eval('$expected = '.trim($test['php']).';');
$this->assertEquals($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']); $this->assertEquals($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
} }

View File

@ -62,9 +62,9 @@ class ParserTest extends \PHPUnit_Framework_TestCase
if (isset($test['todo']) && $test['todo']) { if (isset($test['todo']) && $test['todo']) {
// TODO // TODO
} else { } else {
$expected = var_export(eval('return '.trim($test['php']).';'), true); eval('$expected = '.trim($test['php']).';');
$tests[] = array($file, $expected, $test['yaml'], $test['test']); $tests[] = array($file, var_export($expected, true), $test['yaml'], $test['test']);
} }
} }
} }