Similar to the core issue (#2553655-32: Convert ViewKernelTestBase to use KernelTestBaseTNG) with the ViewExecutable class trying to use the container when it doesn't exist (during phpunit tests for instance), the Query class here should not try to use the container on __wakeup if the container doesn't exist.

CommentFileSizeAuthor
#3 2743697-03.patch581 bytesjhedstrom

Comments

jhedstrom created an issue. See original summary.

jhedstrom’s picture

Issue summary: View changes
jhedstrom’s picture

Status: Active » Needs review
StatusFileSize
new581 bytes

Note that without this fix, the following error is thrown when tests *fail*:

Fatal error: Uncaught Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in /Users/jonathan.hedstrom/work/contributions/cores/drupal/core/lib/Drupal.php on line 129

Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in /Users/jonathan.hedstrom/work/contributions/cores/drupal/core/lib/Drupal.php on line 129

Call Stack:
    0.0033     359528   1. {main}() /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/phpunit:0
    0.0910    1050936   2. PHPUnit_TextUI_Command::main(???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/phpunit:47
    0.0911    1051048   3. PHPUnit_TextUI_Command->run(???, ???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/TextUI/Command.php:100
    0.6391    4572096   4. PHPUnit_TextUI_TestRunner->doRun(???, ???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/TextUI/Command.php:148
    0.6546    4820216   5. PHPUnit_Framework_TestSuite->run(???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:436
    0.6567    4821472   6. PHPUnit_Framework_TestSuite->run(???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/Framework/TestSuite.php:735
    0.6627    4823536   7. PHPUnit_Framework_TestCase->run(???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/Framework/TestSuite.php:735
    0.6649    4957680   8. PHPUnit_Util_PHP->runTestJob(???, ???, ???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/Framework/TestCase.php:703
    7.2237    4999208   9. PHPUnit_Util_PHP->processChildResult(???, ???, ???, ???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/Util/PHP.php:49
    7.2238    4999528  10. unserialize(???) /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/Util/PHP.php:107
    7.2289    5360744  11. Drupal\search_api\Query\Query->__wakeup() /Users/jonathan.hedstrom/work/contributions/cores/drupal/vendor/phpunit/phpunit/src/Util/PHP.php:107
    7.2292    5422304  12. Drupal::entityTypeManager() /Users/jonathan.hedstrom/work/contributions/modules/search_api/src/Query/Query.php:553
    7.2292    5422304  13. Drupal::getContainer() /Users/jonathan.hedstrom/work/contributions/cores/drupal/core/lib/Drupal.php:273
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Sure, that makes sense.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Looks good, thanks!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.