Problem/Motivation
phpunit fails to run tests because of
Fatal error: Cannot redeclare class Drupal\Tests\migrate\Unit\TestMigration in drupal/core/modules/migrate/tests/src/Unit/MigrationTest.php on line 171
Call Stack:
0.0002 234288 1. {main}() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/phpunit:0
0.0091 1106976 2. PHPUnit_TextUI_Command::main() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/phpunit:47
0.0091 1107600 3. PHPUnit_TextUI_Command->run() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/TextUI/Command.php:100
0.0091 1110464 4. PHPUnit_TextUI_Command->handleArguments() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/TextUI/Command.php:111
0.3329 1951872 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/TextUI/Command.php:649
0.3329 1953136 6. PHPUnit_Util_Configuration->getTestSuite() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/Util/Configuration.php:870
3.1698 127304496 7. PHPUnit_Framework_TestSuite->addTestFiles() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/Util/Configuration.php:959
5.2540 203369248 8. PHPUnit_Framework_TestSuite->addTestFile() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/Framework/TestSuite.php:409
5.2545 203664512 9. PHPUnit_Util_Fileloader::checkAndLoad() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/Framework/TestSuite.php:335
5.2545 203664664 10. PHPUnit_Util_Fileloader::load() /Users/mkalkbrenner/git/drupal/vendor/phpunit/phpunit/src/Util/Fileloader.php:38
That happens for example when you run the search_api_solr tests like:
./vendor/bin/phpunit --group search_api_solr_multilingual -c "modules/search_api_solr/phpunit.xml.travis"
The problem is that drupal/core/modules/migrate/tests/src/Unit/MigrationTest.php
and drupal/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
both declare the same class \Drupal\Tests\migrate\Unit\TestMigration
.
The problem was introduced into 8.2.x and 8.1.x by the commit of #2710133: Follow up to #2561697 - Migration should not choke when the content_node_field table isn't available.
Proposed resolution
Rename class TestMigration
to TestMigrationMock
in drupal/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
.
Remaining tasks
Test the patch. None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2725755.patch | 1.42 KB | mkalkbrenner |
Comments
Comment #2
mkalkbrennerComment #3
mkalkbrennerComment #4
mkalkbrennerComment #6
mkalkbrenneruploaded wrong patch file :-(
Comment #7
mkalkbrennerWith this patch applied, search_api_solr tests pass again.
Comment #8
neclimdulFixes the problem for me as well. Looks good.
Comment #9
alexpottCommitted af4dc7f and pushed to 8.1.x and 8.2.x. Thanks!
Comment #11
neclimdulThank you both!