Skip to content

Commit 536645d

Browse files
staabmsebastianbergmann
authored andcommitted
Test require() is executed in subprocess
1 parent 03f0973 commit 536645d

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
PHPT skip condition with IO operations run in main process
3+
--SKIPIF--
4+
<?php declare(strict_types=1);
5+
require (__DIR__ . '/phpt-skipif-required-file.php');
6+
--FILE--
7+
<?php declare(strict_types=1);
8+
echo "Hello, World!\n";
9+
--EXPECT--
10+
Hello, World!
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
namespace PhpTSkipIfRequiredFile;
4+
5+
class SomeClass {}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
The right events are emitted in the right order for PHPT test using require() in skipif
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--debug';
8+
$_SERVER['argv'][] = __DIR__ . '/../_files/phpt-skipif-require.phpt';
9+
10+
require __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit Started (PHPUnit %s using %s)
15+
Test Runner Configured
16+
Event Facade Sealed
17+
Test Suite Loaded (1 test)
18+
Test Runner Started
19+
Test Suite Sorted
20+
Test Runner Execution Started (1 test)
21+
Test Suite Started (%s%ephpt-skipif-require.phpt, 1 test)
22+
Test Preparation Started (%s%ephpt-skipif-require.phpt)
23+
Test Prepared (%s%ephpt-skipif-require.phpt)
24+
Child Process Started
25+
Child Process Finished
26+
Child Process Started
27+
Child Process Finished
28+
Test Passed (%s%ephpt-skipif-require.phpt)
29+
Test Finished (%s%ephpt-skipif-require.phpt)
30+
Test Suite Finished (%s%ephpt-skipif-require.phpt, 1 test)
31+
Test Runner Execution Finished
32+
Test Runner Finished
33+
PHPUnit Finished (Shell Exit Code: 0)

0 commit comments

Comments
 (0)