Closed phil-davis closed 4 years ago
Sadly, https://travis-ci.org/github/Behat/Gherkin/jobs/706486199
Unsilenced deprecation notices (32)
32x: Function ReflectionType::__toString() is deprecated
22x in GherkinTest::testLoader from Tests\Behat\Gherkin
8x in DirectoryLoaderTest::setUp from Tests\Behat\Gherkin\Loader
2x in GherkinFileLoaderTest::testParsingUncachedFeature from Tests\Behat\Gherkin\Loader
The command "vendor/bin/phpunit -v --coverage-clover=coverage.clover" exited with 1.
PHP 7.4 emits a heap of deprecation notices, which might be easy to fix, or might not be.
To solve this, we need to allow installing newer versions of PHPUnit for our testsuite
When I go to phpunit 6 then there are namespace changes for the unit tests, e.g.
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 10 updates, 0 removals
- Updating sebastian/recursion-context (2.0.0 => 3.0.0): Loading from cache
- Installing sebastian/object-reflector (1.1.1): Loading from cache
- Updating sebastian/object-enumerator (2.0.1 => 3.0.3): Loading from cache
- Updating sebastian/global-state (1.1.1 => 2.0.0): Loading from cache
- Updating sebastian/exporter (2.0.0 => 3.1.2): Loading from cache
- Updating sebastian/environment (2.0.0 => 3.1.0): Loading from cache
- Updating sebastian/diff (1.4.3 => 2.0.1): Loading from cache
- Updating sebastian/comparator (1.2.4 => 2.1.3): Loading from cache
- Updating phpunit/phpunit-mock-objects (3.4.4 => 5.0.10): Loading from cache
- Installing theseer/tokenizer (1.1.3): Loading from cache
- Updating phpunit/php-code-coverage (4.0.8 => 5.3.2): Loading from cache
- Installing phar-io/version (1.0.1): Loading from cache
- Installing phar-io/manifest (1.0.1): Loading from cache
- Updating phpunit/phpunit (5.7.27 => 6.5.14): Loading from cache
$ vendor/bin/phpunit
PHP Fatal error: Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in /home/phil/git/JankariTech/Gherkin/tests/Behat/Gherkin/Cache/FileCacheTest.php:10
Stack trace:
#0 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/Util/Fileloader.php(64): include_once()
#1 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/Util/Fileloader.php(48): PHPUnit\Util\Fileloader::load()
#2 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/Framework/TestSuite.php(325): PHPUnit\Util\Fileloader::checkAndLoad()
#3 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/Framework/TestSuite.php(403): PHPUnit\Framework\TestSuite->addTestFile()
#4 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/Util/Configuration.php(1014): PHPUnit\Framework\TestSuite->addTestFiles()
#5 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/Util/Configuration.php(910): PHPUnit\Util\Configuration->getTestSuite()
#6 /home/phil/git/JankariTech/Gherkin/vendor/phpunit/phpunit/src/TextUI/Command.php(837): in /home/phil/git/JankariTech/Gherkin/tests/Behat/Gherkin/Cache/FileCacheTest.php on line 10
Those are easy to fix, but just have to check how far back in phpunit that the new namespace \PHPUnit\Framework\TestCase
became available (since we need to be able to run the unit tests with PHP 5.6)
And then:
There were 3 errors:
1) Tests\Behat\Gherkin\Cache\FileCacheTest::testBrokenCacheRead
Error: Call to undefined method Tests\Behat\Gherkin\Cache\FileCacheTest::setExpectedException()
/home/phil/git/JankariTech/Gherkin/tests/Behat/Gherkin/Cache/FileCacheTest.php:51
2) Tests\Behat\Gherkin\Cache\FileCacheTest::testUnwriteableCacheDir
Error: Call to undefined method Tests\Behat\Gherkin\Cache\FileCacheTest::setExpectedException()
/home/phil/git/JankariTech/Gherkin/tests/Behat/Gherkin/Cache/FileCacheTest.php:59
3) Tests\Behat\Gherkin\Node\StepNodeTest::testThatStepCanHaveOnlyOneArgument
Error: Call to undefined method Tests\Behat\Gherkin\Node\StepNodeTest::setExpectedException()
/home/phil/git/JankariTech/Gherkin/tests/Behat/Gherkin/Node/StepNodeTest.php:13
--
There was 1 risky test:
1) Tests\Behat\Gherkin\ParserExceptionsTest::testTextInBackground
This test did not perform any assertions
ERRORS!
Tests: 332, Assertions: 702, Errors: 3, Risky: 1.
Those can also be easily fixed, but just need to make sure the unit tests still run on PHP 5.6
Namespaced classes (for TestCase and a few other public APIs) are available in 4.8.35+ and 5.7+.
I suggest making a dedicated PR to update the testsuite to use namespaced class names for PHPUnit
@stof PR #172 has the changes to PHPUnit code without actually changing/adding anything in CI. That seems an easy win first.
And PR #173 has enhancements to a test case that make it better and will stop a "risky test" warning in PHPUnit6.
PR #175 has a small adjustment to phpunit.xml.dist
Those PRs can get bits-and-pieces in place before actually changing the versions of PHP or PHPUnit in CI.
Then I can rebase PR #174 to start running newer PHPUnit.
Then finally this PR can be sorted out to add PHP 7.4 to the test matrix.
(or, since https://github.com/Behat/Behat master
is already requiring PHP 7.2+, I could to a PR to go straight to PHP 7.2+ in Behat/Gherkin
with PHPUnit 8 and whatever is needed for that)
This is gradually happening in other PRs.
composer.json
still has:Can that be changed to PHP 5.6 (or 7.0, 7.1 or even 7.2 - which is the oldest version with current support). Bumping the minimum PHP version could make life easier when addressing deprecation notices that PHP 7.4 emits.