Merge branch '3.0'

* 3.0:
  [Process] Fix transient test on Windows
  [Process] Make tests more deterministic
  [PropertyAccess] Reorder elements array after PropertyPathBuilder::replace
  [Validator] fixed wrong php docs
  Improved the design of the web debug toolbar
  [Routing] Skip PhpGeneratorDumperTest::testDumpWithTooManyRoutes on HHVM
  [Process] More robustness and deterministic tests
This commit is contained in:
Nicolas Grekas 2015-12-23 09:01:03 +01:00
commit 676ddab73b
11 changed files with 232 additions and 233 deletions

View File

@ -7,6 +7,9 @@
'subtle_border_and_shadow': 'background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2);' 'subtle_border_and_shadow': 'background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2);'
} %} } %}
{# when updating any of these colors, do the same in toolbar.css.twig #}
{% set colors = { 'success': '#4F805D', 'warning': '#A46A1F', 'error': '#B0413E' } %}
{# Normalization {# Normalization
(normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css) (normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css)
========================================================================= #} ========================================================================= #}
@ -232,9 +235,9 @@ table tbody ul {
padding: 3px 7px; padding: 3px 7px;
white-space: nowrap; white-space: nowrap;
} }
.label.status-success { background: #5E976E; color: #FFF; } .label.status-success { background: {{ colors.success|raw }}; color: #FFF; }
.label.status-warning { background: #BC8034; color: #FFF; } .label.status-warning { background: {{ colors.warning|raw }}; color: #FFF; }
.label.status-error { background: #B0413E; color: #FFF; } .label.status-error { background: {{ colors.error|raw }}; color: #FFF; }
{# Metrics {# Metrics
------------------------------------------------------------------------- #} ------------------------------------------------------------------------- #}
@ -341,11 +344,11 @@ tr.status-warning td {
border-top: 1px solid #FAFAFA; border-top: 1px solid #FAFAFA;
} }
.status-warning .colored { .status-warning .colored {
color: #BC8034; color: {{ colors.warning|raw }};
} }
.status-error .colored { .status-error .colored {
color: #B0413E; color: {{ colors.error|raw }};
} }
{# Syntax highlighting {# Syntax highlighting
@ -469,9 +472,9 @@ tr.status-warning td {
text-decoration: underline; text-decoration: underline;
} }
#summary .status-success { background: #5E976E; } #summary .status-success { background: {{ colors.success|raw }}; }
#summary .status-warning { background: #BC8034; } #summary .status-warning { background: {{ colors.warning|raw }}; }
#summary .status-error { background: #B0413E; } #summary .status-error { background: {{ colors.error|raw }}; }
#summary .status-success h2, #summary .status-success h2,
#summary .status-success h2 a, #summary .status-success h2 a,
@ -670,10 +673,10 @@ tr.status-warning td {
} }
#menu-profiler .label-status-warning .count { #menu-profiler .label-status-warning .count {
background: #BC8034; background: {{ colors.warning|raw }};
} }
#menu-profiler .label-status-error .count { #menu-profiler .label-status-error .count {
background: #B0413E; background: {{ colors.error|raw }};
} }
{# Timeline panel {# Timeline panel

View File

@ -1,3 +1,6 @@
{# when updating any of these colors, do the same in profiler.css.twig #}
{% set colors = { 'success': '#4F805D', 'warning': '#A46A1F', 'error': '#B0413E' } %}
.sf-minitoolbar { .sf-minitoolbar {
background-color: #222; background-color: #222;
border-top-left-radius: 4px; border-top-left-radius: 4px;
@ -46,8 +49,8 @@
} }
.sf-toolbarreset svg, .sf-toolbarreset svg,
.sf-toolbarreset img { .sf-toolbarreset img {
max-height: 24px; max-height: 20px;
max-width: 24px; max-width: 20px;
} }
.sf-toolbarreset .hide-button { .sf-toolbarreset .hide-button {
@ -180,30 +183,31 @@
padding: 3px 6px; padding: 3px 6px;
margin-bottom: 2px; margin-bottom: 2px;
vertical-align: middle; vertical-align: middle;
min-width: 6px; min-width: 15px;
min-height: 13px; min-height: 13px;
text-align: center;
} }
.sf-toolbar-block .sf-toolbar-status-green { .sf-toolbar-block .sf-toolbar-status-green {
background-color: rgba(117, 158, 43, 0.8); background-color: {{ colors.success|raw }};
} }
.sf-toolbar-block .sf-toolbar-status-red { .sf-toolbar-block .sf-toolbar-status-red {
background-color: rgba(200, 43, 43, 0.8); background-color: {{ colors.error|raw }};
} }
.sf-toolbar-block .sf-toolbar-status-yellow { .sf-toolbar-block .sf-toolbar-status-yellow {
background-color: rgb(189, 132, 0); background-color: {{ colors.warning|raw }};
} }
.sf-toolbar-block.sf-toolbar-status-green { .sf-toolbar-block.sf-toolbar-status-green {
background-color: rgba(117, 158, 43, 0.8); background-color: {{ colors.success|raw }};
color: #FFF; color: #FFF;
} }
.sf-toolbar-block.sf-toolbar-status-red { .sf-toolbar-block.sf-toolbar-status-red {
background-color: rgba(200, 43, 43, 0.8); background-color: {{ colors.error|raw }};
color: #FFF; color: #FFF;
} }
.sf-toolbar-block.sf-toolbar-status-yellow { .sf-toolbar-block.sf-toolbar-status-yellow {
background-color: rgb(189, 132, 0); background-color: {{ colors.warning|raw }};
color: #FFF; color: #FFF;
} }

View File

@ -46,6 +46,12 @@ class PhpProcess extends Process
$php .= ' '.ProcessUtils::escapeArgument($file); $php .= ' '.ProcessUtils::escapeArgument($file);
$script = null; $script = null;
} }
if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
// exec is mandatory to deal with sending a signal to the process
// see https://github.com/symfony/symfony/issues/5030 about prepending
// command with exec
$php = 'exec '.$php;
}
parent::__construct($php, $cwd, $env, $script, $timeout, $options); parent::__construct($php, $cwd, $env, $script, $timeout, $options);
} }

View File

@ -76,12 +76,12 @@ class Process
private static $sigchild; private static $sigchild;
private static $posixSignals = array( private static $posixSignals = array(
1 => 1, // SIGHUP 1, // SIGHUP
2 => 2, // SIGINT 2, // SIGINT
3 => 3, // SIGQUIT 3, // SIGQUIT
6 => 6, // SIGABRT 6, // SIGABRT
14 => 14, // SIGALRM 14, // SIGALRM
15 => 15, // SIGTERM 15, // SIGTERM
); );
/** /**
@ -285,11 +285,19 @@ class Process
if (!isset($this->options['bypass_shell'])) { if (!isset($this->options['bypass_shell'])) {
$this->options['bypass_shell'] = true; $this->options['bypass_shell'] = true;
} }
} } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
$descriptors[3] = array('pipe', 'w');
$ptsWorkaround = null; $commandline = '';
foreach (self::$posixSignals as $s) {
$commandline .= "trap 'echo s$s >&3' $s;";
}
// See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
$commandline .= '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
$commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo x$code >&3; exit $code';
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
// Workaround for the bug, when PTS functionality is enabled. // Workaround for the bug, when PTS functionality is enabled.
// @see : https://bugs.php.net/69442 // @see : https://bugs.php.net/69442
$ptsWorkaround = fopen(__FILE__, 'r'); $ptsWorkaround = fopen(__FILE__, 'r');
@ -297,15 +305,15 @@ class Process
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options); $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
if ($ptsWorkaround) {
fclose($ptsWorkaround);
}
if (!is_resource($this->process)) { if (!is_resource($this->process)) {
throw new RuntimeException('Unable to launch a new process.'); throw new RuntimeException('Unable to launch a new process.');
} }
$this->status = self::STATUS_STARTED; $this->status = self::STATUS_STARTED;
if (isset($descriptors[3])) {
$this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
}
if ($this->tty) { if ($this->tty) {
return; return;
} }
@ -596,8 +604,6 @@ class Process
public function getExitCode() public function getExitCode()
{ {
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
$this->stop(0);
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.');
} }
@ -651,8 +657,6 @@ class Process
$this->requireProcessIsTerminated(__FUNCTION__); $this->requireProcessIsTerminated(__FUNCTION__);
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
$this->stop(0);
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.');
} }
@ -674,8 +678,6 @@ class Process
$this->requireProcessIsTerminated(__FUNCTION__); $this->requireProcessIsTerminated(__FUNCTION__);
if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) { if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
$this->stop(0);
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.');
} }
@ -1185,14 +1187,7 @@ class Process
return $result = false; return $result = false;
} }
$proc = @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes); return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
if (is_resource($proc)) {
proc_close($proc);
return $result = true;
}
return $result = false;
} }
/** /**
@ -1207,22 +1202,8 @@ class Process
} else { } else {
$this->processPipes = UnixPipes::create($this, $this->input); $this->processPipes = UnixPipes::create($this, $this->input);
} }
$descriptors = $this->processPipes->getDescriptors($this->outputDisabled);
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { return $this->processPipes->getDescriptors($this->outputDisabled);
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
$descriptors[3] = array('pipe', 'w');
$trap = '';
foreach (self::$posixSignals as $s) {
$trap .= "trap 'echo s$s >&3' $s;";
}
$this->commandline = $trap.'{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
$this->commandline .= 'pid=$!; echo p$pid >&3; wait $pid; code=$?; echo x$code >&3; exit $code';
}
return $descriptors;
} }
/** /**
@ -1340,8 +1321,11 @@ class Process
$this->fallbackStatus['signaled'] = true; $this->fallbackStatus['signaled'] = true;
$this->fallbackStatus['exitcode'] = -1; $this->fallbackStatus['exitcode'] = -1;
$this->fallbackStatus['termsig'] = (int) substr($data, 1); $this->fallbackStatus['termsig'] = (int) substr($data, 1);
} elseif ('x' === $data[0] && !isset($this->fallbackStatus['signaled'])) { } elseif ('x' === $data[0]) {
$this->fallbackStatus['exitcode'] = (int) substr($data, 1); $this->fallbackStatus['running'] = false;
if (!isset($this->fallbackStatus['signaled'])) {
$this->fallbackStatus['exitcode'] = (int) substr($data, 1);
}
} }
} }
} else { } else {
@ -1423,14 +1407,6 @@ class Process
return false; return false;
} }
if ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled() && !isset(self::$posixSignals[$signal]) && !(function_exists('posix_kill') && @posix_kill($this->getPid(), $signal))) {
if ($throwException) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild and posix_kill() is not available.');
}
return false;
}
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode); exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode);
if ($exitCode && $this->isRunning()) { if ($exitCode && $this->isRunning()) {
@ -1440,14 +1416,21 @@ class Process
return false; return false;
} }
} } else {
if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
if (true !== @proc_terminate($this->process, $signal) && '\\' !== DIRECTORY_SEPARATOR) { $ok = @proc_terminate($this->process, $signal);
if ($throwException) { } elseif (function_exists('posix_kill')) {
throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal)); $ok = @posix_kill($this->getPid(), $signal);
} elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $this->getPid()), array(2 => array('pipe', 'w')), $pipes)) {
$ok = false === fgets($pipes[2]);
} }
if (!$ok) {
if ($throwException) {
throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
}
return false; return false;
}
} }
$this->latestSignal = (int) $signal; $this->latestSignal = (int) $signal;

View File

@ -30,16 +30,18 @@ function handleSignal($signal)
break; break;
} }
echo "received signal $name\n"; echo "signal $name\n";
} }
declare (ticks = 1);
pcntl_signal(SIGTERM, 'handleSignal'); pcntl_signal(SIGTERM, 'handleSignal');
pcntl_signal(SIGINT, 'handleSignal'); pcntl_signal(SIGINT, 'handleSignal');
echo 'received ';
$duration = isset($argv[1]) ? (int) $argv[1] : 3; $duration = isset($argv[1]) ? (int) $argv[1] : 3;
$start = microtime(true); $start = microtime(true);
while ($duration > (microtime(true) - $start)) { while ($duration > (microtime(true) - $start)) {
usleep(1000); usleep(10000);
pcntl_signal_dispatch();
} }

View File

@ -24,12 +24,23 @@ use Symfony\Component\Process\Process;
class ProcessTest extends \PHPUnit_Framework_TestCase class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
private static $phpBin; private static $phpBin;
private static $sigchild;
private static $notEnhancedSigchild = false; private static $notEnhancedSigchild = false;
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
$phpBin = new PhpExecutableFinder(); $phpBin = new PhpExecutableFinder();
self::$phpBin = 'phpdbg' === PHP_SAPI ? 'php' : $phpBin->find(); self::$phpBin = 'phpdbg' === PHP_SAPI ? 'php' : $phpBin->find();
if ('\\' !== DIRECTORY_SEPARATOR) {
// exec is mandatory to deal with sending a signal to the process
// see https://github.com/symfony/symfony/issues/5030 about prepending
// command with exec
self::$phpBin = 'exec '.self::$phpBin;
}
ob_start();
phpinfo(INFO_GENERAL);
self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
} }
public function testThatProcessDoesNotThrowWarningDuringRun() public function testThatProcessDoesNotThrowWarningDuringRun()
@ -78,20 +89,18 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testStopWithTimeoutIsActuallyWorking() public function testStopWithTimeoutIsActuallyWorking()
{ {
// exec is mandatory here since we send a signal to the process $p = $this->getProcess(self::$phpBin.' '.__DIR__.'/NonStopableProcess.php 30');
// see https://github.com/symfony/symfony/issues/5030 about prepending
// command with exec
$p = $this->getProcess('exec '.self::$phpBin.' '.__DIR__.'/NonStopableProcess.php 3');
$p->start(); $p->start();
usleep(100000);
$start = microtime(true); while (false === strpos($p->getOutput(), 'received')) {
$p->stop(1.1, SIGKILL);
while ($p->isRunning()) {
usleep(1000); usleep(1000);
} }
$duration = microtime(true) - $start; $start = microtime(true);
$p->stop(0.1);
$this->assertLessThan(4, $duration); $p->wait();
$this->assertLessThan(15, microtime(true) - $start);
} }
public function testAllOutputIsActuallyReadOnTermination() public function testAllOutputIsActuallyReadOnTermination()
@ -109,12 +118,16 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code))); $p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
$p->start(); $p->start();
// Let's wait enough time for process to finish...
// Here we don't call Process::run or Process::wait to avoid any read of pipes
usleep(500000);
if ($p->isRunning()) { // Don't call Process::run nor Process::wait to avoid any read of pipes
$this->markTestSkipped('Process execution did not complete in the required time frame'); $h = new \ReflectionProperty($p, 'process');
$h->setAccessible(true);
$h = $h->getValue($p);
$s = proc_get_status($h);
while ($s['running']) {
usleep(1000);
$s = proc_get_status($h);
} }
$o = $p->getOutput(); $o = $p->getOutput();
@ -124,18 +137,14 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testCallbacksAreExecutedWithStart() public function testCallbacksAreExecutedWithStart()
{ {
$data = ''; $process = $this->getProcess('echo foo');
$process = $this->getProcess('echo foo && '.self::$phpBin.' -r "sleep(1);" && echo foo');
$process->start(function ($type, $buffer) use (&$data) { $process->start(function ($type, $buffer) use (&$data) {
$data .= $buffer; $data .= $buffer;
}); });
while ($process->isRunning()) { $process->wait();
usleep(10000);
}
$this->assertEquals(2, preg_match_all('/foo/', $data, $matches)); $this->assertSame('foo'.PHP_EOL, $data);
} }
/** /**
@ -200,7 +209,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testSetInputWhileRunningThrowsAnException() public function testSetInputWhileRunningThrowsAnException()
{ {
$process = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(30);"');
$process->start(); $process->start();
try { try {
$process->setInput('foobar'); $process->setInput('foobar');
@ -220,7 +229,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInvalidInput($value) public function testInvalidInput($value)
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('foo');
$process->setInput($value); $process->setInput($value);
} }
@ -237,7 +246,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testValidInput($expected, $value) public function testValidInput($expected, $value)
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('foo');
$process->setInput($value); $process->setInput($value);
$this->assertSame($expected, $process->getInput()); $this->assertSame($expected, $process->getInput());
} }
@ -455,7 +464,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testTTYCommand() public function testTTYCommand()
{ {
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does have /dev/tty support'); $this->markTestSkipped('Windows does not have /dev/tty support');
} }
$process = $this->getProcess('echo "foo" >> /dev/null && '.self::$phpBin.' -r "usleep(100000);"'); $process = $this->getProcess('echo "foo" >> /dev/null && '.self::$phpBin.' -r "usleep(100000);"');
@ -567,12 +576,12 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
$process->start(); $process->start();
$end = microtime(true); $end = microtime(true);
$this->assertLessThan(0.4, $end - $start); $this->assertLessThan(0.4, $end - $start);
$process->wait(); $process->stop();
} }
public function testUpdateStatus() public function testUpdateStatus()
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run(); $process->run();
$this->assertTrue(strlen($process->getOutput()) > 0); $this->assertTrue(strlen($process->getOutput()) > 0);
} }
@ -581,7 +590,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -r "usleep(200000);"'); $process = $this->getProcess(self::$phpBin.' -r "usleep(100000);"');
$this->assertNull($process->getExitCode()); $this->assertNull($process->getExitCode());
$process->start(); $process->start();
$this->assertNull($process->getExitCode()); $this->assertNull($process->getExitCode());
@ -593,7 +602,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -r "usleep(200000);"'); $process = $this->getProcess(self::$phpBin.' -r "usleep(100000);"');
$process->run(); $process->run();
$this->assertEquals(0, $process->getExitCode()); $this->assertEquals(0, $process->getExitCode());
$process->start(); $process->start();
@ -606,14 +615,14 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run(); $process->run();
$this->assertSame(0, $process->getExitCode()); $this->assertSame(0, $process->getExitCode());
} }
public function testStatus() public function testStatus()
{ {
$process = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $process = $this->getProcess(self::$phpBin.' -r "usleep(100000);"');
$this->assertFalse($process->isRunning()); $this->assertFalse($process->isRunning());
$this->assertFalse($process->isStarted()); $this->assertFalse($process->isStarted());
$this->assertFalse($process->isTerminated()); $this->assertFalse($process->isTerminated());
@ -632,7 +641,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testStop() public function testStop()
{ {
$process = $this->getProcess(self::$phpBin.' -r "sleep(4);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(31);"');
$process->start(); $process->start();
$this->assertTrue($process->isRunning()); $this->assertTrue($process->isRunning());
$process->stop(); $process->stop();
@ -643,7 +652,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run(); $process->run();
$this->assertTrue($process->isSuccessful()); $this->assertTrue($process->isSuccessful());
} }
@ -652,14 +661,12 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -r "sleep(1);"'); $process = $this->getProcess(self::$phpBin.' -r "usleep(100000);"');
$process->start(); $process->start();
$this->assertFalse($process->isSuccessful()); $this->assertFalse($process->isSuccessful());
while ($process->isRunning()) { $process->wait();
usleep(300000);
}
$this->assertTrue($process->isSuccessful()); $this->assertTrue($process->isSuccessful());
} }
@ -668,10 +675,8 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
{ {
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -r "usleep(500000);throw new \Exception(\'BOUM\');"'); $process = $this->getProcess(self::$phpBin.' -r "throw new \Exception(\'BOUM\');"');
$process->start(); $process->run();
$this->assertTrue($process->isRunning());
$process->wait();
$this->assertFalse($process->isSuccessful()); $this->assertFalse($process->isSuccessful());
} }
@ -682,19 +687,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
} }
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run();
$this->assertFalse($process->hasBeenSignaled());
}
public function testProcessWithoutTermSignalIsNotSignaled()
{
if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not support POSIX signals');
}
$this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -v');
$process->run(); $process->run();
$this->assertFalse($process->hasBeenSignaled()); $this->assertFalse($process->hasBeenSignaled());
} }
@ -706,7 +699,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
} }
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run(); $process->run();
$this->assertEquals(0, $process->getTermSignal()); $this->assertEquals(0, $process->getTermSignal());
} }
@ -718,23 +711,10 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
} }
$this->skipIfNotEnhancedSigchild(); $this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -r "sleep(4);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(32);"');
$process->start(); $process->start();
$process->stop(); $process->stop();
$this->assertTrue($process->hasBeenSignaled()); $this->assertTrue($process->hasBeenSignaled());
}
public function testProcessWithTermSignal()
{
if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Windows does not support POSIX signals');
}
$this->skipIfNotEnhancedSigchild();
$process = $this->getProcess(self::$phpBin.' -r "sleep(4);"');
$process->start();
$process->stop();
$this->assertEquals(15, $process->getTermSignal()); // SIGTERM $this->assertEquals(15, $process->getTermSignal()); // SIGTERM
} }
@ -749,11 +729,9 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
} }
$this->skipIfNotEnhancedSigchild(false); $this->skipIfNotEnhancedSigchild(false);
$termSignal = defined('SIGKILL') ? SIGKILL : 9; $process = $this->getProcess(self::$phpBin.' -r "sleep(32.1)"');
$process = $this->getProcess('exec '.self::$phpBin.' -r "while (true) {}"');
$process->start(); $process->start();
posix_kill($process->getPid(), $termSignal); posix_kill($process->getPid(), 9); // SIGKILL
$process->wait(); $process->wait();
} }
@ -778,12 +756,12 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
/** /**
* @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
* @expectedExceptionMessage exceeded the timeout of 0.5 seconds. * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
*/ */
public function testRunProcessWithTimeout() public function testRunProcessWithTimeout()
{ {
$timeout = 0.5; $timeout = 0.1;
$process = $this->getProcess(self::$phpBin.' -r "usleep(600000);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(1);"');
$process->setTimeout($timeout); $process->setTimeout($timeout);
$start = microtime(true); $start = microtime(true);
try { try {
@ -804,25 +782,25 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testCheckTimeoutOnNonStartedProcess() public function testCheckTimeoutOnNonStartedProcess()
{ {
$process = $this->getProcess(self::$phpBin.' -r "sleep(3);"'); $process = $this->getProcess('echo foo');
$process->checkTimeout(); $this->assertNull($process->checkTimeout());
} }
public function testCheckTimeoutOnTerminatedProcess() public function testCheckTimeoutOnTerminatedProcess()
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run(); $process->run();
$process->checkTimeout(); $this->assertNull($process->checkTimeout());
} }
/** /**
* @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
* @expectedExceptionMessage exceeded the timeout of 0.5 seconds. * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
*/ */
public function testCheckTimeoutOnStartedProcess() public function testCheckTimeoutOnStartedProcess()
{ {
$process = $this->getProcess(self::$phpBin.' -r "sleep(3);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(33);"');
$process->setTimeout(0.5); $process->setTimeout(0.1);
$process->start(); $process->start();
$start = microtime(true); $start = microtime(true);
@ -832,30 +810,29 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
$process->checkTimeout(); $process->checkTimeout();
usleep(100000); usleep(100000);
} }
$this->fail('A RuntimeException should have been raised'); $this->fail('A ProcessTimedOutException should have been raised');
} catch (RuntimeException $e) { } catch (ProcessTimedOutException $e) {
} }
$duration = microtime(true) - $start;
$this->assertLessThan(3, $duration); $this->assertLessThan(15, microtime(true) - $start);
throw $e; throw $e;
} }
public function testIdleTimeout() public function testIdleTimeout()
{ {
$process = $this->getProcess(self::$phpBin.' -r "sleep(3);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(34);"');
$process->setTimeout(10); $process->setTimeout(60);
$process->setIdleTimeout(0.5); $process->setIdleTimeout(0.1);
try { try {
$process->run(); $process->run();
$this->fail('A timeout exception was expected.'); $this->fail('A timeout exception was expected.');
} catch (ProcessTimedOutException $ex) { } catch (ProcessTimedOutException $e) {
$this->assertTrue($ex->isIdleTimeout()); $this->assertTrue($e->isIdleTimeout());
$this->assertFalse($ex->isGeneralTimeout()); $this->assertFalse($e->isGeneralTimeout());
$this->assertEquals(0.5, $ex->getExceededTimeout()); $this->assertEquals(0.1, $e->getExceededTimeout());
} }
} }
@ -864,17 +841,23 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestIncomplete('This test fails with a timeout on Windows, can someone investigate please?'); $this->markTestIncomplete('This test fails with a timeout on Windows, can someone investigate please?');
} }
$process = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 30; while ($n--) {echo "foo\n"; usleep(100000); }'))); $process = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('while (true) {echo "foo\n"; usleep(10000);}')));
$process->setTimeout(2); $process->setTimeout(1);
$process->setIdleTimeout(1); $process->start();
while (false === strpos($process->getOutput(), 'foo')) {
usleep(1000);
}
$process->setIdleTimeout(0.1);
try { try {
$process->run(); $process->wait();
$this->fail('A timeout exception was expected.'); $this->fail('A timeout exception was expected.');
} catch (ProcessTimedOutException $ex) { } catch (ProcessTimedOutException $ex) {
$this->assertTrue($ex->isGeneralTimeout(), 'A general timeout is expected.'); $this->assertTrue($ex->isGeneralTimeout(), 'A general timeout is expected.');
$this->assertFalse($ex->isIdleTimeout(), 'No idle timeout is expected.'); $this->assertFalse($ex->isIdleTimeout(), 'No idle timeout is expected.');
$this->assertEquals(2, $ex->getExceededTimeout()); $this->assertEquals(1, $ex->getExceededTimeout());
} }
} }
@ -884,38 +867,39 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testStartAfterATimeout() public function testStartAfterATimeout()
{ {
$process = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 1000; while ($n--) {echo \'\'; usleep(1000); }'))); $process = $this->getProcess(self::$phpBin.' -r "sleep(35);"');
$process->setTimeout(0.1); $process->setTimeout(0.1);
try { try {
$process->run(); $process->run();
$this->fail('A RuntimeException should have been raised.'); $this->fail('A ProcessTimedOutException should have been raised.');
} catch (RuntimeException $e) { } catch (ProcessTimedOutException $e) {
} }
$this->assertFalse($process->isRunning());
$process->start(); $process->start();
usleep(1000); $this->assertTrue($process->isRunning());
$process->stop(); $process->stop(0);
throw $e; throw $e;
} }
public function testGetPid() public function testGetPid()
{ {
$process = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(36);"');
$process->start(); $process->start();
$this->assertGreaterThan(0, $process->getPid()); $this->assertGreaterThan(0, $process->getPid());
$process->wait(); $process->stop(0);
} }
public function testGetPidIsNullBeforeStart() public function testGetPidIsNullBeforeStart()
{ {
$process = $this->getProcess(self::$phpBin.' -r "sleep(1);"'); $process = $this->getProcess('foo');
$this->assertNull($process->getPid()); $this->assertNull($process->getPid());
} }
public function testGetPidIsNullAfterRun() public function testGetPidIsNullAfterRun()
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('echo foo');
$process->run(); $process->run();
$this->assertNull($process->getPid()); $this->assertNull($process->getPid());
} }
@ -925,7 +909,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testSignal() public function testSignal()
{ {
$process = $this->getProcess('exec '.self::$phpBin.' '.__DIR__.'/SignalListener.php'); $process = $this->getProcess(self::$phpBin.' '.__DIR__.'/SignalListener.php');
$process->start(); $process->start();
while (false === strpos($process->getOutput(), 'Caught')) { while (false === strpos($process->getOutput(), 'Caught')) {
@ -964,7 +948,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testSignalProcessNotRunning() public function testSignalProcessNotRunning()
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('foo');
$process->signal(1); // SIGHUP $process->signal(1); // SIGHUP
} }
@ -973,7 +957,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMethodsThatNeedARunningProcess($method) public function testMethodsThatNeedARunningProcess($method)
{ {
$process = $this->getProcess(self::$phpBin.' -v'); $process = $this->getProcess('foo');
$this->setExpectedException('Symfony\Component\Process\Exception\LogicException', sprintf('Process must be started before calling %s.', $method)); $this->setExpectedException('Symfony\Component\Process\Exception\LogicException', sprintf('Process must be started before calling %s.', $method));
$process->{$method}(); $process->{$method}();
} }
@ -996,7 +980,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMethodsThatNeedATerminatedProcess($method) public function testMethodsThatNeedATerminatedProcess($method)
{ {
$process = $this->getProcess(self::$phpBin.' -r "sleep(1);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(37);"');
$process->start(); $process->start();
try { try {
$process->{$method}(); $process->{$method}();
@ -1020,36 +1004,38 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @dataProvider provideWrongSignal
* @expectedException \Symfony\Component\Process\Exception\RuntimeException * @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/ */
public function testSignalWithWrongIntSignal() public function testWrongSignal($signal)
{ {
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('POSIX signals do not work on Windows'); $this->markTestSkipped('POSIX signals do not work on Windows');
} }
$process = $this->getProcess(self::$phpBin.' -r "sleep(3);"'); $process = $this->getProcess(self::$phpBin.' -r "sleep(38);"');
$process->start(); $process->start();
$process->signal(-4); try {
$process->signal($signal);
$this->fail('A RuntimeException must have been thrown');
} catch (RuntimeException $e) {
$process->stop(0);
}
throw $e;
} }
/** public function provideWrongSignal()
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
public function testSignalWithWrongNonIntSignal()
{ {
if ('\\' === DIRECTORY_SEPARATOR) { return array(
$this->markTestSkipped('POSIX signals do not work on Windows'); array(-4),
} array('Céphalopodes'),
);
$process = $this->getProcess(self::$phpBin.' -r "sleep(3);"');
$process->start();
$process->signal('Céphalopodes');
} }
public function testDisableOutputDisablesTheOutput() public function testDisableOutputDisablesTheOutput()
{ {
$p = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $p = $this->getProcess('foo');
$this->assertFalse($p->isOutputDisabled()); $this->assertFalse($p->isOutputDisabled());
$p->disableOutput(); $p->disableOutput();
$this->assertTrue($p->isOutputDisabled()); $this->assertTrue($p->isOutputDisabled());
@ -1063,7 +1049,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testDisableOutputWhileRunningThrowsException() public function testDisableOutputWhileRunningThrowsException()
{ {
$p = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $p = $this->getProcess(self::$phpBin.' -r "sleep(39);"');
$p->start(); $p->start();
$p->disableOutput(); $p->disableOutput();
} }
@ -1074,7 +1060,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testEnableOutputWhileRunningThrowsException() public function testEnableOutputWhileRunningThrowsException()
{ {
$p = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $p = $this->getProcess(self::$phpBin.' -r "sleep(40);"');
$p->disableOutput(); $p->disableOutput();
$p->start(); $p->start();
$p->enableOutput(); $p->enableOutput();
@ -1082,12 +1068,12 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testEnableOrDisableOutputAfterRunDoesNotThrowException() public function testEnableOrDisableOutputAfterRunDoesNotThrowException()
{ {
$p = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $p = $this->getProcess('echo foo');
$p->disableOutput(); $p->disableOutput();
$p->start(); $p->run();
$p->wait();
$p->enableOutput(); $p->enableOutput();
$p->disableOutput(); $p->disableOutput();
$this->assertTrue($p->isOutputDisabled());
} }
/** /**
@ -1096,7 +1082,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testDisableOutputWhileIdleTimeoutIsSet() public function testDisableOutputWhileIdleTimeoutIsSet()
{ {
$process = $this->getProcess('sleep 3'); $process = $this->getProcess('foo');
$process->setIdleTimeout(1); $process->setIdleTimeout(1);
$process->disableOutput(); $process->disableOutput();
} }
@ -1107,16 +1093,16 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testSetIdleTimeoutWhileOutputIsDisabled() public function testSetIdleTimeoutWhileOutputIsDisabled()
{ {
$process = $this->getProcess('sleep 3'); $process = $this->getProcess('foo');
$process->disableOutput(); $process->disableOutput();
$process->setIdleTimeout(1); $process->setIdleTimeout(1);
} }
public function testSetNullIdleTimeoutWhileOutputIsDisabled() public function testSetNullIdleTimeoutWhileOutputIsDisabled()
{ {
$process = $this->getProcess('sleep 3'); $process = $this->getProcess('foo');
$process->disableOutput(); $process->disableOutput();
$process->setIdleTimeout(null); $this->assertSame($process, $process->setIdleTimeout(null));
} }
/** /**
@ -1124,7 +1110,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testStartWithACallbackAndDisabledOutput($startMethod, $exception, $exceptionMessage) public function testStartWithACallbackAndDisabledOutput($startMethod, $exception, $exceptionMessage)
{ {
$p = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $p = $this->getProcess('foo');
$p->disableOutput(); $p->disableOutput();
$this->setExpectedException($exception, $exceptionMessage); $this->setExpectedException($exception, $exceptionMessage);
if ('mustRun' === $startMethod) { if ('mustRun' === $startMethod) {
@ -1149,7 +1135,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGetOutputWhileDisabled($fetchMethod) public function testGetOutputWhileDisabled($fetchMethod)
{ {
$p = $this->getProcess(self::$phpBin.' -r "usleep(500000);"'); $p = $this->getProcess(self::$phpBin.' -r "sleep(41);"');
$p->disableOutput(); $p->disableOutput();
$p->start(); $p->start();
$p->{$fetchMethod}(); $p->{$fetchMethod}();
@ -1167,7 +1153,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testStopTerminatesProcessCleanly() public function testStopTerminatesProcessCleanly()
{ {
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"'); $process = $this->getProcess(self::$phpBin.' -r "echo 123; sleep(42);"');
$process->run(function () use ($process) { $process->run(function () use ($process) {
$process->stop(); $process->stop();
}); });
@ -1176,22 +1162,18 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
public function testKillSignalTerminatesProcessCleanly() public function testKillSignalTerminatesProcessCleanly()
{ {
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"'); $process = $this->getProcess(self::$phpBin.' -r "echo 123; sleep(43);"');
$process->run(function () use ($process) { $process->run(function () use ($process) {
if ($process->isRunning()) { $process->signal(9); // SIGKILL
$process->signal(9); // SIGKILL
}
}); });
$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException'); $this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException');
} }
public function testTermSignalTerminatesProcessCleanly() public function testTermSignalTerminatesProcessCleanly()
{ {
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"'); $process = $this->getProcess(self::$phpBin.' -r "echo 123; sleep(44);"');
$process->run(function () use ($process) { $process->run(function () use ($process) {
if ($process->isRunning()) { $process->signal(15); // SIGTERM
$process->signal(15); // SIGTERM
}
}); });
$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException'); $this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException');
} }
@ -1282,11 +1264,11 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
private function skipIfNotEnhancedSigchild($expectException = true) private function skipIfNotEnhancedSigchild($expectException = true)
{ {
if (self::$notEnhancedSigchild) { if (self::$sigchild) {
if ($expectException) { if (!$expectException) {
$this->markTestSkipped('PHP is compiled with --enable-sigchild.');
} elseif (self::$notEnhancedSigchild) {
$this->setExpectedException('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild.'); $this->setExpectedException('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild.');
} else {
$this->markTestSkipped('PHP is compiled with --enable-sigchild and enhanced mode is disabled.');
} }
} }
} }

View File

@ -142,6 +142,7 @@ class PropertyPathBuilder
$this->elements[$offset + $i] = $path->getElement($pathOffset + $i); $this->elements[$offset + $i] = $path->getElement($pathOffset + $i);
$this->isIndex[$offset + $i] = $path->isIndex($pathOffset + $i); $this->isIndex[$offset + $i] = $path->isIndex($pathOffset + $i);
} }
ksort($this->elements);
} }
/** /**

View File

@ -252,6 +252,17 @@ class PropertyPathBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($path, $builder->getPropertyPath()); $this->assertEquals($path, $builder->getPropertyPath());
} }
public function testReplaceWithLongerPathKeepsOrder()
{
$path = new PropertyPath('new1.new2.new3');
$expected = new PropertyPath('new1.new2.new3.old2');
$builder = new PropertyPathBuilder(new PropertyPath('old1.old2'));
$builder->replace(0, 1, $path);
$this->assertEquals($expected, $builder->getPropertyPath());
}
public function testRemove() public function testRemove()
{ {
$this->builder->remove(3); $this->builder->remove(3);

View File

@ -85,6 +85,10 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
public function testDumpWithTooManyRoutes() public function testDumpWithTooManyRoutes()
{ {
if (defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('HHVM consumes too much memory on this test.');
}
$this->routeCollection->add('Test', new Route('/testing/{foo}')); $this->routeCollection->add('Test', new Route('/testing/{foo}'));
for ($i = 0; $i < 32769; ++$i) { for ($i = 0; $i < 32769; ++$i) {
$this->routeCollection->add('route_'.$i, new Route('/route_'.$i)); $this->routeCollection->add('route_'.$i, new Route('/route_'.$i));

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Validator; namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* Entry point for the Validator component. * Entry point for the Validator component.
* *

View File

@ -15,6 +15,7 @@ use Doctrine\Common\Annotations\Reader;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Mapping\Cache\CacheInterface; use Symfony\Component\Validator\Mapping\Cache\CacheInterface;
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* A configurable builder for ValidatorInterface objects. * A configurable builder for ValidatorInterface objects.