class UpdateStorageTest
Same name and namespace in other branches
- 11.x core/modules/update/tests/src/Kernel/UpdateStorageTest.php \Drupal\Tests\update\Kernel\UpdateStorageTest
- 10 core/modules/update/tests/src/Kernel/UpdateStorageTest.php \Drupal\Tests\update\Kernel\UpdateStorageTest
Tests the Update module storage is cleared correctly.
@group update
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\update\Kernel\UpdateStorageTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of UpdateStorageTest
File
-
core/
modules/ update/ tests/ src/ Kernel/ UpdateStorageTest.php, line 12
Namespace
Drupal\Tests\update\KernelView source
class UpdateStorageTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'update',
];
/**
* Tests the Update module storage is cleared correctly.
*/
public function testUpdateStorage() {
// Setting values in both key stores, then installing the module and
// testing if these key values are cleared.
$keyvalue_update = $this->container
->get('keyvalue.expirable')
->get('update');
$keyvalue_update->set('key', 'some value');
$keyvalue_update_available_release = $this->container
->get('keyvalue.expirable')
->get('update_available_release');
$keyvalue_update_available_release->set('key', 'some value');
$this->container
->get('module_installer')
->install([
'help',
]);
$this->assertNull($keyvalue_update->get('key'));
$this->assertNull($keyvalue_update_available_release->get('key'));
// Setting new values in both key stores, then uninstalling the module and
// testing if these new key values are cleared.
$keyvalue_update->set('another_key', 'some value');
$keyvalue_update_available_release->set('another_key', 'some value');
$this->container
->get('module_installer')
->uninstall([
'help',
]);
$this->assertNull($keyvalue_update->get('another_key'));
$this->assertNull($keyvalue_update_available_release->get('another_key'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.