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

TextUI TestRunner cannot run a non-TestSuite Test instance #3254

Closed
BHSPitMonkey opened this issue Aug 14, 2018 · 0 comments · Fixed by elecena/nano#2
Closed

TextUI TestRunner cannot run a non-TestSuite Test instance #3254

BHSPitMonkey opened this issue Aug 14, 2018 · 0 comments · Fixed by elecena/nano#2

Comments

@BHSPitMonkey
Copy link

BHSPitMonkey commented Aug 14, 2018

Q A
PHPUnit version 7.3
PHP version 7.1
Installation Method Composer
$ composer info | sort
brianium/habitat                   v1.0.0 A dependable php environment
brianium/paratest                  2.0    Parallel testing for PHP
composer/semver                    1.4.2  Semver library that offers util...
doctrine/instantiator              1.1.0  A small, lightweight utility to...
myclabs/deep-copy                  1.8.1  Create deep copies (clones) of ...
phar-io/manifest                   1.0.3  Component for reading phar.io m...
phar-io/version                    2.0.1  Library for handling version in...
phpdocumentor/reflection-common    1.0.1  Common reflection classes used ...
phpdocumentor/reflection-docblock  4.3.0  With this component, a library ...
phpdocumentor/type-resolver        0.4.0 
phpspec/prophecy                   1.8.0  Highly opinionated mocking fram...
phpunit/php-code-coverage          6.0.7  Library that provides collectio...
phpunit/php-file-iterator          2.0.1  FilterIterator implementation t...
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 ...
phpunit/phpunit                    7.3.1  The PHP Unit Testing framework.
sebastian/code-unit-reverse-lookup 1.0.1  Looks up which function or meth...
sebastian/comparator               3.0.2  Provides the functionality to c...
sebastian/diff                     3.0.1  Diff implementation
sebastian/environment              3.1.0  Provides functionality to handl...
sebastian/exporter                 3.1.0  Provides the functionality to e...
sebastian/global-state             2.0.0  Snapshotting of global state
sebastian/object-enumerator        3.0.3  Traverses array structures and ...
sebastian/object-reflector         1.1.1  Allows reflection of object att...
sebastian/recursion-context        3.0.0  Provides functionality to recur...
sebastian/resource-operations      1.0.0  Provides a list of PHP built-in...
sebastian/version                  2.0.1  Library that helps with managin...
symfony/console                    v4.1.3 Symfony Console Component
symfony/polyfill-mbstring          v1.9.0 Symfony polyfill for the Mbstri...
symfony/process                    v4.1.3 Symfony Process Component
theseer/tokenizer                  1.1.0  A small library for converting ...
webmozart/assert                   1.3.0  Assertions to validate method i...

It seems that TextUI/TestRunner::doRun has an issue when passed an object that isn't a TestSuite. If the constructor argument to run is a non-TestSuite Test object, things start to break beginning with a call to $this->processSuiteFilters, (https://github.com/sebastianbergmann/phpunit/blob/master/src/TextUI/TestRunner.php#L158) which expects a TestSuite instance.

This is at odds with the TestRunner::doRun type hint (which specifies Test), and the TestRunner::run function itself (which appears to accept Test instances by design). This also means that the Example 12.5 in the manual (https://phpunit.readthedocs.io/en/7.3/extending-phpunit.html#implement-phpunit-framework-test) cannot actually work.

sebastianfeldmann pushed a commit to sebastianfeldmann/phpunit that referenced this issue Sep 7, 2018
sebastianfeldmann pushed a commit to sebastianfeldmann/phpunit that referenced this issue Sep 7, 2018
Make sure the 'processSuiteFilters' method is only called for
'TestSuite' objects not for 'Test' objects.
To achieve this, the 'processSuiteFilters' method call got
moved to an existing type check.

Fix issue sebastianbergmann#3254
sebastianfeldmann pushed a commit to sebastianfeldmann/phpunit that referenced this issue Sep 7, 2018
sebastianfeldmann pushed a commit to sebastianfeldmann/phpunit that referenced this issue Sep 7, 2018
Make sure the 'processSuiteFilters' method is only called
for 'TestSuite' objects not for 'Test' objects. To achieve this,
the 'processSuiteFilters' method call got  moved to an existing
type check.

Fix issue sebastianbergmann#3254
sebastianbergmann pushed a commit that referenced this issue Sep 7, 2018
Make sure the 'processSuiteFilters' method is only called
for 'TestSuite' objects not for 'Test' objects. To achieve this,
the 'processSuiteFilters' method call got  moved to an existing
type check.

Fix issue #3254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants