function CacheRebuildCommandTest::testConsoleCommand
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Core/Console/CacheRebuildCommandTest.php \Drupal\FunctionalTests\Core\Console\CacheRebuildCommandTest::testConsoleCommand()
Tests the cache:rebuild command.
File
-
core/
tests/ Drupal/ FunctionalTests/ Core/ Console/ CacheRebuildCommandTest.php, line 39
Class
- CacheRebuildCommandTest
- Tests the cache:rebuild command.
Namespace
Drupal\FunctionalTests\Core\ConsoleCode
public function testConsoleCommand() : void {
$command = new CacheRebuildCommand(new ClassLoader());
$tester = new CommandTester($command);
$code = $tester->execute([]);
$this->assertStringContainsString('All caches have been rebuilt.', $tester->getDisplay());
$this->assertEquals(Command::SUCCESS, $code);
// Cache rebuild includes utility.inc, which sets an error handler. This
// sets the error handler to the test bootstrap handler avoid a risky test
// warning: "Test code or tested code removed error handlers other than its
// own".
set_error_handler(new BootstrapErrorHandler(PhpUnitErrorHandler::instance()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.