Skip to content

phpunit/phpunit-selenium does not work with PHPUnit 8.5.9 #4516

@bobemoe

Description

@bobemoe

Summary

After update from 8.5.8 to 8.5.9 phpunit seems to be "testing" all the internal methods of the Selenium2TestCase.

Current behaviour

A simple Selenium2TestCase test fails, with hundreds of failed tests.

PHPUnit 8.5.9 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.19-1~deb10u1

Unnamed Tests (App\Tests\UnnamedTests)
 ☢ Set up [1022.11 ms]
   │
   │ This test did not perform any assertions
   │
   │ /home/bob/Projects/phpunittest/test.php:8
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ✔  [1350.83 ms]
 ✘ Share session [1183.80 ms]
   │
   │ ArgumentCountError: Too few arguments to function PHPUnit\Extensions\Selenium2TestCase::shareSession(), 0 passed in /home/bob/Projects/phpunittest/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1415 and exactly 1 expected
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:199
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:395
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ✘ Keep session on failure [1149.94 ms]
   │
   │ ArgumentCountError: Too few arguments to function PHPUnit\Extensions\Selenium2TestCase::keepSessionOnFailure(), 0 passed in /home/bob/Projects/phpunittest/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1415 and exactly 1 expected
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:213
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:395
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ✘ Session strategy [1730.11 ms]
   │
   │ BadMethodCallException: The command 'sessionStrategy' is not existent or not supported yet.
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php:159
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php:105
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:440
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:395
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ✘ Default session strategy [1119.84 ms]
   │
   │ BadMethodCallException: The command 'defaultSessionStrategy' is not existent or not supported yet.
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php:159
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php:105
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:440
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:395
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ☢ Default wait until timeout [1086.11 ms]
   │
   │ This test did not perform any assertions
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:240
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ✘ Set default wait until timeout [1100.62 ms]
   │
   │ ArgumentCountError: Too few arguments to function PHPUnit\Extensions\Selenium2TestCase::setDefaultWaitUntilTimeout(), 0 passed in /home/bob/Projects/phpunittest/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1415 and exactly 1 expected
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:248
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:395
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ☢ Default wait until sleep interval [1215.09 ms]
   │
   │ This test did not perform any assertions
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:257
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │

 ✘ Set default wait until sleep interval [1176.35 ms]
   │
   │ ArgumentCountError: Too few arguments to function PHPUnit\Extensions\Selenium2TestCase::setDefaultWaitUntilSleepInterval(), 0 passed in /home/bob/Projects/phpunittest/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1415 and exactly 1 expected
   │
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:265
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:395
   │ /home/bob/Projects/phpunittest/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:360
   │
^C

How to reproduce

Clone my simple test case

git clone https://github.com/bobemoe/phpunit_selenium_test
cd phpunit_selenium_test
composer install
vendor/bin/phpunit -v test.php --testdox

See here one test is ran, as expected. Now update phpunit and try again:

composer require phpunit/phpunit:8.5.9 --update-with-dependencies
vendor/bin/phpunit -v test.php --testdox

Now there are hundreds of tests being executed that aren't even defined in test.php.

Expected behaviour

The single test defined in test.php is executed.

More details at: https://github.com/bobemoe/phpunit_selenium_test

Composer show

doctrine/instantiator              1.4.0   A small, lightweight utility to instantiate objects in PHP without invoking their constructors
myclabs/deep-copy                  1.10.1  Create deep copies (clones) of your objects
phar-io/manifest                   1.0.3   Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    2.0.1   Library for handling version information and constraints
phpdocumentor/reflection-common    2.2.0   Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock  5.2.2   With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information t...
phpdocumentor/type-resolver        1.4.0   A PSR-5 based resolver of Class names, Types and Structural Element Names
phpspec/prophecy                   1.12.1  Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage          7.0.10  Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          2.0.2   FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template          1.2.1   Simple template engine.
phpunit/php-timer                  2.1.2   Utility class for timing
phpunit/php-token-stream           3.1.1   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    8.5.9   The PHP Unit Testing framework.
phpunit/phpunit-selenium           8.0.0   Selenium Server integration for PHPUnit
sebastian/code-unit-reverse-lookup 1.0.1   Looks up which function or method a line of code belongs to
sebastian/comparator               3.0.2   Provides the functionality to compare PHP values for equality
sebastian/diff                     3.0.2   Diff implementation
sebastian/environment              4.2.3   Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 3.1.2   Provides the functionality to export PHP variables for visualization
sebastian/global-state             3.0.0   Snapshotting of global state
sebastian/object-enumerator        3.0.3   Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         1.1.1   Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        3.0.0   Provides functionality to recursively process PHP variables
sebastian/resource-operations      2.0.1   Provides a list of PHP built-in functions that operate on resources
sebastian/type                     1.1.3   Collection of value objects that represent the types of the PHP type system
sebastian/version                  2.0.1   Library that helps with managing the version number of Git-hosted PHP projects
symfony/polyfill-ctype             v1.20.0 Symfony polyfill for ctype functions
theseer/tokenizer                  1.2.0   A small library for converting tokenized PHP source code into XML and potentially other formats
webmozart/assert                   1.9.1   Assertions to validate method input/output with nice error messages.

Metadata

Metadata

Labels

type/bugSomething is broken

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions