Skip to content

Commit

Permalink
Add test for running tests in child process which are calling "exit"
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored and sebastianbergmann committed Dec 5, 2019
1 parent 81b7b0e commit ca4411e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/_files/SeparateProcessesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PHPUnit\Framework\TestCase;

/**
* @runTestsInSeparateProcesses
*/
class SeparateProcessesTest extends TestCase
{
public function testFoo(): void
{
$this->assertTrue(true);
exit(0);
}

public function testBar(): void
{
$this->assertTrue(true);
$this->assertTrue(true);
exit(1);
}
}
17 changes: 17 additions & 0 deletions tests/end-to-end/separate-processes-test.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit --no-configuration ../../_files/SeparateProcessesTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/SeparateProcessesTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

.. 2 / 2 (100%)

Time: %s, Memory: %s

OK (2 tests, 0 assertions)

0 comments on commit ca4411e

Please sign in to comment.