libphonenumber-for-php: tests failing with `phpunit` - fatal error for syntax issues?
Hello,
I know one should use ./phpunit (hence simple-phpunit) for the tests, but actually I don’t have the possibility to use it, so I run the tests by executing phpunit. I can’t use simple-phpunit because that script it is not packaged in Debian and it is likely it won’t be. I need to run the test because I’m trying to package your lib into an official Debian package, and we are strongly advised to run upstream’s test suite in the package.
Running phpunit returns this error
PHP Fatal error: Declaration of libphonenumber\Tests\Issues\CodeCoverageTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in php-giggsey-libphonenumber/tests/Issues/CodeCoverageTest.php on line 16
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /usr/bin/phpunit:42
PHP 3. PHPUnit\TextUI\Command->run($argv = [0 => '/usr/bin/phpunit'], $exit = TRUE) /usr/share/php/PHPUnit/TextUI/Command.php:95
PHP 4. PHPUnit\TextUI\Command->handleArguments($argv = [0 => '/usr/bin/phpunit']) /usr/share/php/PHPUnit/TextUI/Command.php:110
PHP 5. PHPUnit\TextUI\TestSuiteMapper->map($configuration = class PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection { private $testSuites = [0 => class PHPUnit\TextUI\XmlConfiguration\TestSuite { ... }] }, $filter = '') /usr/share/php/PHPUnit/TextUI/Command.php:389
PHP 6. PHPUnit\Framework\TestSuite->addTestFiles($fileNames = [0 => 'php-giggsey-libphonenumber/tests/Issues/CodeCoverageTest.php', 1 => 'php-giggsey-libphonenumber/tests/Issues/Issue106Test.php', 2 => 'php-giggsey-libphonenumber/tests/Issues/Issue135Test.php', 3 => 'php-giggsey-libphonenumber/tests/Issues/Issue14Test.php', 4 => 'php-giggsey-libphonenumber/tests/Issues/Issue152Test.php', 5 => 'php-giggsey-libphonenumber/tests/Issues/Issue159Test.php', 6 => 'php-giggsey-libphonenumber/tests/Issues/Issue175Test.php', 7 => 'php-giggsey-libphonenumber/tests/Issues/Issue17Test.php', 8 => 'php-giggsey-libphonenumber/tests/Issues/Issue21Test.php', 9 => 'php-giggsey-libphonenumber/tests/Issues/Issue23Test.php', 10 => 'php-giggsey-libphonenumber/tests/Issues/Issue34Test.php', 11 => 'php-giggsey-libphonenumber/tests/Issues/Issue35Test.php', 12 => 'php-giggsey-libphonenumber/tests/Issues/Issue360Test.php', 13 => 'php-giggsey-libphonenumber/tests/Issues/Issue36Test.php', 14 => 'php-giggsey-libphonenumber/tests/Issues/Issue3Test.php', 15 => 'php-giggsey-libphonenumber/tests/Issues/Issue44Test.php', 16 => 'php-giggsey-libphonenumber/tests/Issues/Issue4Test.php', 17 => 'php-giggsey-libphonenumber/tests/Issues/Issue64Test.php', 18 => 'php-giggsey-libphonenumber/tests/Issues/Issue68Test.php', 19 => 'php-giggsey-libphonenumber/tests/Issues/Issue76Test.php', 20 => 'php-giggsey-libphonenumber/tests/Issues/LocaleTest.php', 21 => 'php-giggsey-libphonenumber/tests/Issues/PHP7Test.php', 22 => 'php-giggsey-libphonenumber/tests/Issues/UKNumbersTest.php', 23 => 'php-giggsey-libphonenumber/tests/buildtools/BuildMetadataFromXmlTest.php', 24 => 'php-giggsey-libphonenumber/tests/buildtools/GeneratePhonePrefixDataTest.php', 25 => 'php-giggsey-libphonenumber/tests/buildtools/MetadataFilterTest.php', 26 => 'php-giggsey-libphonenumber/tests/carrier/PhoneNumberToCarrierMapperTest.php', 27 => 'php-giggsey-libphonenumber/tests/core/AsYouTypeFormatterTest.php', 28 => 'php-giggsey-libphonenumber/tests/core/ExampleNumbersTest.php', 29 => 'php-giggsey-libphonenumber/tests/core/MatcherTest.php', 30 => 'php-giggsey-libphonenumber/tests/core/MultiFileMetadataSourceImplTest.php', 31 => 'php-giggsey-libphonenumber/tests/core/PhoneMetadataTest.php', 32 => 'php-giggsey-libphonenumber/tests/core/PhoneNumberMatchTest.php', 33 => 'php-giggsey-libphonenumber/tests/core/PhoneNumberMatcherTest.php', 34 => 'php-giggsey-libphonenumber/tests/core/PhoneNumberTest.php', 35 => 'php-giggsey-libphonenumber/tests/core/PhoneNumberUtilTest.php', 36 => 'php-giggsey-libphonenumber/tests/core/ShortNumberInfoTest.php', 37 => 'php-giggsey-libphonenumber/tests/geocoding/PhoneNumberOfflineGeocoderTest.php', 38 => 'php-giggsey-libphonenumber/tests/prefixmapper/PrefixFileReaderTest.php', 39 => 'php-giggsey-libphonenumber/tests/timezone/PrefixTimeZonesMapTest.php', 40 => 'php-giggsey-libphonenumber/tests/timezone/UKTest.php']) /usr/share/php/PHPUnit/TextUI/TestSuiteMapper.php:67
PHP 7. PHPUnit\Framework\TestSuite->addTestFile($filename = 'php-giggsey-libphonenumber/tests/Issues/CodeCoverageTest.php') /usr/share/php/PHPUnit/Framework/TestSuite.php:530
PHP 8. PHPUnit\Util\FileLoader::checkAndLoad($filename = 'php-giggsey-libphonenumber/tests/Issues/CodeCoverageTest.php') /usr/share/php/PHPUnit/Framework/TestSuite.php:402
PHP 9. PHPUnit\Util\FileLoader::load($filename = 'php-giggsey-libphonenumber/tests/Issues/CodeCoverageTest.php') /usr/share/php/PHPUnit/Util/FileLoader.php:49
PHP 10. include_once() /usr/share/php/PHPUnit/Util/FileLoader.php:65
Would you fix your tests so that they also work with phpunit?
phpunit --version
PHPUnit 9.5.2 by Sebastian Bergmann and contributors.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 20 (10 by maintainers)
It would be much preferable if the logic could be changed upstream so that no patches are needed in Debian package, but well, I understand it can not always be done.