8000 minor #13446 [Process] Make test AbstractProcessTest::testStartAfterA… · symfony/symfony@051402e · GitHub
[go: up one dir, main page]

Skip to content

Commit 051402e

Browse files
committed
minor #13446 [Process] Make test AbstractProcessTest::testStartAfterATimeout useful again (ymc-dabe)
This PR was squashed before being merged into the 2.3 branch (closes #13446). Discussion ---------- [Process] Make test AbstractProcessTest::testStartAfterATimeout useful again | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - The test AbstractProcessTest::testStartAfterATimeout() is pretty useless, due to two reasons: 1. Any exception is caught This means even the exception thrown with <code>$this->fail('A RuntimeException should have been raised.');</code> is caught, making the test pretty useless. 2. Invalid PHP code gets executed The command that is executed in the tests actually is: <code># php -r "$n = 1000; while ($n--) {echo ''; usleep(1000); }"</code> . This does not wait ~1s, but produces the following error: <code>PHP Parse error: syntax error, unexpected '=' in Command line code on line 1</code> Commits ------- 1be266f [Process] Make test AbstractProcessTest::testStartAfterATimeout useful again
2 parents c05395c + 1be266f commit 051402e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,12 @@ public function testCheckTimeoutOnStartedProcess()
724724

725725
public function testStartAfterATimeout()
726726
{
727-
$process = $this->getProcess('php -r "$n = 1000; while ($n--) {echo \'\'; usleep(1000); }"');
727+
$process = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 1000; while ($n--) {echo \'\'; usleep(1000); }')));
728728
$process->setTimeout(0.1);
729729
try {
730730
$process->run();
731-
$this->fail('An exception should have been raised.');
732-
} catch (\Exception $e) {
731+
$this->fail('A RuntimeException should have been raised.');
732+
} catch (RuntimeException $e) {
733733
}
734734
$process->start();
735735
usleep(10000);

0 commit comments

Comments
 (0)
0