Skip to content

Commit 0057bca

Browse files
Merge branch '7.4'
2 parents 12893f8 + 786bb8f commit 0057bca

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

ChangeLog-7.4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 7.4 release series are documented in this fil
77
### Fixed
88

99
* Fixed [#3379](https://github.com/sebastianbergmann/phpunit/issues/3379): Dependent test of skipped test has status `-1`
10+
* Fixed [#3394](https://github.com/sebastianbergmann/phpunit/issues/3394): Process Isolation does not work when PHPUnit is used as PHAR
1011

1112
## [7.4.3] - 2018-10-23
1213

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
</exec>
121121
</target>
122122

123-
<target name="phar" depends="-phar-determine-version,-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies">
123+
<target name="phar" depends="-phar-prepare,-phar-determine-version" description="Create PHAR archive of PHPUnit and all its dependencies">
124124
<antcall target="-phar-build">
125125
<param name="type" value="release"/>
126126
</antcall>

build/binary-phar-autoload.php.in

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,16 @@ Phar::mapPhar('___PHAR___');
4040

4141
___FILELIST___
4242

43-
if (!$execute) {
44-
exit;
45-
}
46-
47-
if (isset($printManifest)) {
48-
print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt');
43+
if ($execute) {
44+
if (isset($printManifest)) {
45+
print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt');
4946

50-
exit;
51-
}
47+
exit;
48+
}
5249

53-
unset($execute);
50+
unset($execute);
5451

55-
PHPUnit\TextUI\Command::main();
52+
PHPUnit\TextUI\Command::main();
53+
}
5654

5755
__HALT_COMPILER();

src/Framework/TestCase.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,11 +686,9 @@ public function run(TestResult $result = null): TestResult
686686
return $result;
687687
}
688688

689-
$runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess;
689+
if ($this->runInSeparateProcess()) {
690+
$runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess;
690691

691-
if (($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) &&
692-
$this->inIsolation !== true &&
693-
!$this instanceof PhptTestCase) {
694692
$class = new ReflectionClass($this);
695693

696694
if ($runEntireClass) {
@@ -2113,4 +2111,10 @@ private function checkExceptionExpectations(Throwable $throwable): bool
21132111

21142112
return $result;
21152113
}
2114+
2115+
private function runInSeparateProcess(): bool
2116+
{
2117+
return ($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) &&
2118+
$this->inIsolation !== true && !$this instanceof PhptTestCase;
2119+
}
21162120
}

src/Util/Test.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PHPUnit\Util;
1111

1212
use PharIo\Version\VersionConstraintParser;
13+
use PHPUnit\Framework\Assert;
1314
use PHPUnit\Framework\CodeCoverageException;
1415
use PHPUnit\Framework\Exception;
1516
use PHPUnit\Framework\InvalidCoversTargetException;
@@ -706,6 +707,14 @@ public static function getHookMethods(string $className): array
706707
$class = new ReflectionClass($className);
707708

708709
foreach ($class->getMethods() as $method) {
710+
if ($method->getDeclaringClass()->getName() === Assert::class) {
711+
continue;
712+
}
713+
714+
if ($method->getDeclaringClass()->getName() === TestCase::class) {
715+
continue;
716+
}
717+
709718
if (self::isBeforeClassMethod($method)) {
710719
\array_unshift(
711720
self::$hookMethods[$className]['beforeClass'],

0 commit comments

Comments
 (0)