class CacheRebuildCommandTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Core/Console/CacheRebuildCommandTest.php \Drupal\FunctionalTests\Core\Console\CacheRebuildCommandTest
Tests the cache:rebuild command.
Attributes
#[Group('Console')]
#[RunTestsInSeparateProcesses]
#[CoversClass(CacheRebuildCommand::class)]
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Core\Console\CacheRebuildCommandTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of CacheRebuildCommandTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Core/ Console/ CacheRebuildCommandTest.php, line 21
Namespace
Drupal\FunctionalTests\Core\ConsoleView source
class CacheRebuildCommandTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the cache:rebuild command.
*/
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.