Skip to content

Commit

Permalink
Merge branch '7.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 8, 2018
2 parents 12893f8 + 786bb8f commit 0057bca
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions ChangeLog-7.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 7.4 release series are documented in this fil
### Fixed

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

## [7.4.3] - 2018-10-23

Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</exec>
</target>

<target name="phar" depends="-phar-determine-version,-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies">
<target name="phar" depends="-phar-prepare,-phar-determine-version" description="Create PHAR archive of PHPUnit and all its dependencies">
<antcall target="-phar-build">
<param name="type" value="release"/>
</antcall>
Expand Down
18 changes: 8 additions & 10 deletions build/binary-phar-autoload.php.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,16 @@ Phar::mapPhar('___PHAR___');

___FILELIST___

if (!$execute) {
exit;
}

if (isset($printManifest)) {
print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt');
if ($execute) {
if (isset($printManifest)) {
print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt');

exit;
}
exit;
}

unset($execute);
unset($execute);

PHPUnit\TextUI\Command::main();
PHPUnit\TextUI\Command::main();
}

__HALT_COMPILER();
12 changes: 8 additions & 4 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,9 @@ public function run(TestResult $result = null): TestResult
return $result;
}

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

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

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

return $result;
}

private function runInSeparateProcess(): bool
{
return ($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) &&
$this->inIsolation !== true && !$this instanceof PhptTestCase;
}
}
9 changes: 9 additions & 0 deletions src/Util/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace PHPUnit\Util;

use PharIo\Version\VersionConstraintParser;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\CodeCoverageException;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\InvalidCoversTargetException;
Expand Down Expand Up @@ -706,6 +707,14 @@ public static function getHookMethods(string $className): array
$class = new ReflectionClass($className);

foreach ($class->getMethods() as $method) {
if ($method->getDeclaringClass()->getName() === Assert::class) {
continue;
}

if ($method->getDeclaringClass()->getName() === TestCase::class) {
continue;
}

if (self::isBeforeClassMethod($method)) {
\array_unshift(
self::$hookMethods[$className]['beforeClass'],
Expand Down

0 comments on commit 0057bca

Please sign in to comment.