Skip to content

Commit 9da10e7

Browse files
Clean up test
1 parent ada16b7 commit 9da10e7

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,43 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
use PHPUnit\Framework\TestCase;
11+
1012
/**
1113
* @runClassInSeparateProcess
1214
*/
13-
class SeparateClassRunMethodInNewProcessTest extends PHPUnit\Framework\TestCase
15+
final class SeparateClassRunMethodInNewProcessTest extends TestCase
1416
{
1517
public const PROCESS_ID_FILE_PATH = __DIR__ . '/parent_process_id.txt';
1618

17-
public const INITIAL_MASTER_PID = 0;
19+
public const INITIAL_PARENT_PROCESS_ID = 0;
1820

19-
public const INITIAL_PID1 = 1;
21+
public const INITIAL_PROCESS_ID = 1;
2022

21-
public static $masterPid = self::INITIAL_MASTER_PID;
23+
public static $parentProcessId = self::INITIAL_PARENT_PROCESS_ID;
2224

23-
public static $pid1 = self::INITIAL_PID1;
25+
public static $processId = self::INITIAL_PROCESS_ID;
2426

2527
public static function setUpBeforeClass(): void
2628
{
27-
parent::setUpBeforeClass();
28-
2929
if (\file_exists(self::PROCESS_ID_FILE_PATH)) {
30-
static::$masterPid = (int) \file_get_contents(self::PROCESS_ID_FILE_PATH);
30+
self::$parentProcessId = (int) \file_get_contents(self::PROCESS_ID_FILE_PATH);
3131
}
3232
}
3333

3434
public static function tearDownAfterClass(): void
3535
{
36-
parent::tearDownAfterClass();
37-
3836
if (\file_exists(self::PROCESS_ID_FILE_PATH)) {
3937
\unlink(self::PROCESS_ID_FILE_PATH);
4038
}
4139
}
4240

43-
public function testMethodShouldGetDifferentPidThanMaster(): void
41+
public function testTestMethodIsRunInSeparateProcess(): void
4442
{
45-
static::$pid1 = \getmypid();
46-
47-
$this->assertNotEquals(self::INITIAL_PID1, static::$pid1);
48-
$this->assertNotEquals(self::INITIAL_MASTER_PID, static::$masterPid);
43+
self::$processId = \getmypid();
4944

50-
$this->assertNotEquals(static::$pid1, static::$masterPid);
45+
$this->assertNotSame(self::INITIAL_PROCESS_ID, self::$processId);
46+
$this->assertNotSame(self::INITIAL_PARENT_PROCESS_ID, self::$parentProcessId);
47+
$this->assertNotSame(self::$processId, self::$parentProcessId);
5148
}
5249
}

0 commit comments

Comments
 (0)