Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e73e1a

Browse filesBrowse files
minor #16702 [Process] Don't catch RuntimeException when it complicates tests debugging (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- [Process] Don't catch RuntimeException when it complicates tests debugging | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - See https://github.com/symfony/symfony/pull/16702/files?w=1 Commits ------- 8588a4f [Process] Don't catch RuntimeException when it complicates tests debugging
2 parents f8a7ddb + 8588a4f commit 4e73e1a
Copy full SHA for 4e73e1a

File tree

Expand file treeCollapse file tree

1 file changed

+19
-28
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-28
lines changed

‎src/Symfony/Component/Process/Tests/SimpleProcessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/SimpleProcessTest.php
+19-28Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -152,46 +152,37 @@ public function testSignalWithWrongNonIntSignal()
152152

153153
public function testStopTerminatesProcessCleanly()
154154
{
155-
try {
156-
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
157-
$process->run(function () use ($process) {
158-
$process->stop();
159-
});
160-
} catch (\RuntimeException $e) {
161-
$this->fail('A call to stop() is not expected to cause wait() to throw a RuntimeException');
162-
}
155+
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
156+
$process->run(function () use ($process) {
157+
$process->stop();
158+
});
159+
$this->assertTrue(true, 'A call to stop() is not expected to cause wait() to throw a RuntimeException');
163160
}
164161

165162
public function testKillSignalTerminatesProcessCleanly()
166163
{
167164
$this->expectExceptionIfPHPSigchild('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
168165

169-
try {
170-
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
171-
$process->run(function () use ($process) {
172-
if ($process->isRunning()) {
173-
$process->signal(defined('SIGKILL') ? SIGKILL : 9);
174-
}
175-
});
176-
} catch (\RuntimeException $e) {
177-
$this->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
178-
}
166+
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
167+
$process->run(function () use ($process) {
168+
if ($process->isRunning()) {
169+
$process->signal(defined('SIGKILL') ? SIGKILL : 9);
170+
}
171+
});
172+
$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException');
179173
}
180174

181175
public function testTermSignalTerminatesProcessCleanly()
182176
{
183177
$this->expectExceptionIfPHPSigchild('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
184178

185-
try {
186-
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
187-
$process->run(function () use ($process) {
188-
if ($process->isRunning()) {
189-
$process->signal(defined('SIGTERM') ? SIGTERM : 15);
190-
}
191-
});
192-
} catch (\RuntimeException $e) {
193-
$this->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
194-
}
179+
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
180+
$process->run(function () use ($process) {
181+
if ($process->isRunning()) {
182+
$process->signal(defined('SIGTERM') ? SIGTERM : 15);
183+
}
184+
});
185+
$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException');
195186
}
196187

197188
public function testStopWithTimeoutIsActuallyWorking()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.