UpdateStorageTest.php in Drupal 10
File
core/modules/update/tests/src/Kernel/UpdateStorageTest.php
View source
<?php
namespace Drupal\Tests\update\Kernel;
use Drupal\KernelTests\KernelTestBase;
class UpdateStorageTest extends KernelTestBase {
protected static $modules = [
'update',
];
public function testUpdateStorage() {
$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'));
$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'));
}
}