Skip to content

@runClassInSeparateProcess has the same effect as @runTestsInSeparateProcesses #3258

Closed
@bugreportuser

Description

@bugreportuser
Q A
PHPUnit version 7.4-dev
PHP version 7.2.7
Installation Method Composer

@runClassInSeparateProcess has the same effect as @runTestsInSeparateProcesses and makes test SeparateClassPreserveTest.php fail when it's run by itself. My project has the same problem so I think the problem is with the annotation.

The older versions I tested have the same problem.

$ ./phpunit tests__Regression__GitHub__2591__SeparateClassPreserveTest
PHPUnit 7.4-dev by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.7-0ubuntu0.18.04.2
Configuration: /home/.../phpunit-master/phpunit.xml

E.E                                                                 3 / 3 (100%)

Time: 120 ms, Memory: 4.00MB

There were 2 errors:

1) Issue2591_SeparateClassPreserveTest::testOriginalGlobalString
Undefined index: globalString

/home/ubuntu/Downloads/phpunit-master/tests/Regression/GitHub/2591/SeparateClassPreserveTest.php:20
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestCase.php:1150
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestCase.php:844
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestResult.php:665
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestCase.php:798

2) Issue2591_SeparateClassPreserveTest::testGlobalString
Undefined index: globalString

/home/ubuntu/Downloads/phpunit-master/tests/Regression/GitHub/2591/SeparateClassPreserveTest.php:33
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestCase.php:1150
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestCase.php:844
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestResult.php:665
/home/ubuntu/Downloads/phpunit-master/src/Framework/TestCase.php:798

ERRORS!
Tests: 3, Assertions: 1, Errors: 2.

It makes sense for the first test to fail but the third shouldn't.

All tests pass when run together.

$ composer info | sort
doctrine/instantiator              1.1.0 A small, lightweight utility to ...
myclabs/deep-copy                  1.8.1 Create deep copies (clones) of y...
phar-io/manifest                   1.0.3 Component for reading phar.io ma...
phar-io/version                    2.0.1 Library for handling version inf...
phpdocumentor/reflection-common    1.0.1 Common reflection classes used b...
phpdocumentor/reflection-docblock  4.3.0 With this component, a library c...
phpdocumentor/type-resolver        0.4.0
phpspec/prophecy                   1.8.0 Highly opinionated mocking frame...
phpunit/php-code-coverage          6.0.7 Library that provides collection...
phpunit/php-file-iterator          2.0.1 FilterIterator implementation th...
phpunit/php-text-template          1.2.1 Simple template engine.
phpunit/php-timer                  2.0.0 Utility class for timing
phpunit/php-token-stream           3.0.0 Wrapper around PHP's tokenizer e...
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or metho...
sebastian/comparator               3.0.2 Provides the functionality to co...
sebastian/diff                     3.0.1 Diff implementation
sebastian/environment              3.1.0 Provides functionality to handle...
sebastian/exporter                 3.1.0 Provides the functionality to ex...
sebastian/global-state             2.0.0 Snapshotting of global state
sebastian/object-enumerator        3.0.3 Traverses array structures and o...
sebastian/object-reflector         1.1.1 Allows reflection of object attr...
sebastian/recursion-context        3.0.0 Provides functionality to recurs...
sebastian/resource-operations      1.0.0 Provides a list of PHP built-in ...
sebastian/version                  2.0.1 Library that helps with managing...
theseer/tokenizer                  1.1.0 A small library for converting t...
webmozart/assert                   1.3.0 Assertions to validate method in...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature/process-isolationIssues related to running tests in separate PHP processestype/bugSomething is broken

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions