Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests with process isolation does not allow defining auto_prepend_file for child processes #5860

Open
azabolotnyi opened this issue Jun 11, 2024 · 0 comments
Labels
feature/process-isolation Issues related to running tests in separate PHP processes feature/test-runner CLI test runner type/bug Something is broken

Comments

@azabolotnyi
Copy link

When running tests like this: php -d auto_prepend_file=foo.php vendor/bin/phpunit the foo.php file will not be loaded for the child php processes i.e. for each test case.

What is expected

foo.php to be loaded for each test case in the suite.

What actually happens

foo.php is not loaded because "-d auto_prepend_file" is not passed over to the child processes.

Versions affected

Both latest 10.x and 11.x are affected. Did not check in 9.x.

Sample code

https://github.com/azabolotnyi/phpunit-testcases

Notes

Using <ini> in phpunit.xml has no effect either, because auto_prepend_file can't be affected by ini_set() - and that's how <ini> values are set by PHPUnit.

Possible solution

Capture -d parameters from the parent php process and pass them into the SeparateProcessTestRunner.

Composer info

myclabs/deep-copy                  1.11.1 Create deep copies (clones) of your objects
nikic/php-parser                   v5.0.2 A PHP parser written in PHP
phar-io/manifest                   2.0.4  Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.2.1  Library for handling version information and constraints
phpunit/php-code-coverage          11.0.3 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          5.0.0  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                5.0.0  Invoke callables with a timeout
phpunit/php-text-template          4.0.0  Simple template engine.
phpunit/php-timer                  7.0.0  Utility class for timing
phpunit/phpunit                    11.2.1 The PHP Unit Testing framework.
sebastian/cli-parser               3.0.1  Library for parsing CLI options
sebastian/code-unit                3.0.0  Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 4.0.0  Looks up which function or method a line of code belongs to
sebastian/comparator               6.0.0  Provides the functionality to compare PHP values for equality
sebastian/complexity               4.0.0  Library for calculating the complexity of PHP code units
sebastian/diff                     6.0.1  Diff implementation
sebastian/environment              7.1.0  Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 6.0.1  Provides the functionality to export PHP variables for visualization
sebastian/global-state             7.0.1  Snapshotting of global state
sebastian/lines-of-code            3.0.0  Library for counting the lines of code in PHP source code
sebastian/object-enumerator        6.0.0  Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         4.0.0  Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        6.0.0  Provides functionality to recursively process PHP variables
sebastian/type                     5.0.0  Collection of value objects that represent the types of the PHP type system
sebastian/version                  5.0.0  Library that helps with managing the version number of Git-hosted PHP projects
theseer/tokenizer                  1.2.3  A small library for converting tokenized PHP source code into XML and potentially other formats
@sebastianbergmann sebastianbergmann added type/bug Something is broken feature/test-runner CLI test runner feature/process-isolation Issues related to running tests in separate PHP processes labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/process-isolation Issues related to running tests in separate PHP processes feature/test-runner CLI test runner type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants