Skip to content

Commit 746ab44

Browse files
committed
Issue #2591 - do not pass methodName if running entire test class in a separate process.
1 parent 172bab7 commit 746ab44

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

src/Framework/TestCase.php

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -830,31 +830,36 @@ public function run(TestResult $result = null)
830830

831831
$runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess;
832832

833+
$var = [
834+
'composerAutoload' => $composerAutoload,
835+
'phar' => $phar,
836+
'filename' => $class->getFileName(),
837+
'className' => $class->getName(),
838+
'runEntireClass' => $runEntireClass,
839+
'collectCodeCoverageInformation' => $coverage,
840+
'data' => $data,
841+
'dataName' => $dataName,
842+
'dependencyInput' => $dependencyInput,
843+
'constants' => $constants,
844+
'globals' => $globals,
845+
'include_path' => $includePath,
846+
'included_files' => $includedFiles,
847+
'iniSettings' => $iniSettings,
848+
'isStrictAboutTestsThatDoNotTestAnything' => $isStrictAboutTestsThatDoNotTestAnything,
849+
'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests,
850+
'enforcesTimeLimit' => $enforcesTimeLimit,
851+
'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests,
852+
'isStrictAboutResourceUsageDuringSmallTests' => $isStrictAboutResourceUsageDuringSmallTests,
853+
'codeCoverageFilter' => $codeCoverageFilter,
854+
'configurationFilePath' => $configurationFilePath
855+
];
856+
857+
if (!$runEntireClass) {
858+
$var['methodName'] = $this->name;
859+
}
860+
833861
$template->setVar(
834-
[
835-
'composerAutoload' => $composerAutoload,
836-
'phar' => $phar,
837-
'filename' => $class->getFileName(),
838-
'className' => $class->getName(),
839-
'methodName' => $runEntireClass ? null : $this->name,
840-
'runEntireClass' => $runEntireClass,
841-
'collectCodeCoverageInformation' => $coverage,
842-
'data' => $data,
843-
'dataName' => $dataName,
844-
'dependencyInput' => $dependencyInput,
845-
'constants' => $constants,
846-
'globals' => $globals,
847-
'include_path' => $includePath,
848-
'included_files' => $includedFiles,
849-
'iniSettings' => $iniSettings,
850-
'isStrictAboutTestsThatDoNotTestAnything' => $isStrictAboutTestsThatDoNotTestAnything,
851-
'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests,
852-
'enforcesTimeLimit' => $enforcesTimeLimit,
853-
'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests,
854-
'isStrictAboutResourceUsageDuringSmallTests' => $isStrictAboutResourceUsageDuringSmallTests,
855-
'codeCoverageFilter' => $codeCoverageFilter,
856-
'configurationFilePath' => $configurationFilePath
857-
]
862+
$var
858863
);
859864

860865
$this->prepareTemplate($template);

src/Util/PHP/Template/TestCaseMethod.tpl.dist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ function __phpunit_run_isolated_test()
4747
$result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests});
4848
$result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests});
4949

50-
$test = new {className}('{methodName}', unserialize('{data}'), '{dataName}');
50+
if (isset($runEntireClass) && $runEntireClass) {
51+
$test = new {className}(null, unserialize('{data}'), '{dataName}');
52+
} else {
53+
$test = new {className}('{methodName}', unserialize('{data}'), '{dataName}');
54+
}
55+
5156
$test->setDependencyInput(unserialize('{dependencyInput}'));
5257
$test->setInIsolation(TRUE);
5358

0 commit comments

Comments
 (0)