class BrokenCacheUpdateTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/UpdateSystem/BrokenCacheUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\BrokenCacheUpdateTest
- 10 core/modules/system/tests/src/Functional/UpdateSystem/BrokenCacheUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\BrokenCacheUpdateTest
- 8.9.x core/modules/system/tests/src/Functional/UpdateSystem/BrokenCacheUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\BrokenCacheUpdateTest
Ensures that a broken or out-of-date element info cache is not used.
@group Update
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Functional\UpdateSystem\BrokenCacheUpdateTest uses \Drupal\Tests\UpdatePathTestTrait implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of BrokenCacheUpdateTest
File
-
core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ BrokenCacheUpdateTest.php, line 14
Namespace
Drupal\Tests\system\Functional\UpdateSystemView source
class BrokenCacheUpdateTest extends BrowserTestBase {
use UpdatePathTestTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->ensureUpdatesToRun();
}
/**
* Ensures that a broken or out-of-date element info cache is not used.
*/
public function testUpdate() {
$connection = Database::getConnection();
// Create broken element info caches entries.
$insert = $connection->upsert('cache_discovery');
$insert->key('cid');
$fields = [
'cid' => 'element_info',
'data' => 'BROKEN',
'expire' => -1,
'created' => '1549505157.144',
'serialized' => 1,
'tags' => '',
'checksum' => 0,
];
$insert->fields($fields);
$fields['cid'] = 'element_info_build:claro';
$fields['tags'] = 'element_info_build';
$insert->values(array_values($fields));
$fields['cid'] = 'element_info_build:stark';
$insert->values(array_values($fields));
$insert->execute();
$this->runUpdates();
// Caches should have been cleared at this point.
$count = (int) $connection->select('cache_discovery')
->condition('cid', [
'element_info',
'element_info_build:claro',
'element_info_build:stark',
], 'IN')
->countQuery()
->execute()
->fetchField();
$this->assertSame(0, $count);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.