public function UpdateChecklistTest::testModulesInstalledHook in Update helper 2.x
Same name and namespace in other branches
- 8 modules/update_helper_checklist/tests/src/Kernel/UpdateChecklistTest.php \Drupal\Tests\update_helper_checklist\Kernel\UpdateChecklistTest::testModulesInstalledHook()
Test update hook: update_helper_checklist_modules_installed.
File
- modules/
update_helper_checklist/ tests/ src/ Kernel/ UpdateChecklistTest.php, line 72
Class
Namespace
Drupal\Tests\update_helper_checklist\KernelCode
public function testModulesInstalledHook() {
$first_update_checklist_entry = Update::load('update_helper_checklist_test:update_helper_checklist_test_update_8001');
$this
->assertEquals(NULL, $first_update_checklist_entry);
$this->container
->get('module_installer')
->install([
'update_helper_checklist_test',
]);
$all_saved = Update::loadMultiple();
$expected_all_saved_ids = [
'update_helper_checklist_test:update_helper_checklist_test_update_8001',
'update_helper_checklist_test:update_helper_checklist_test_update_8002',
'update_helper_checklist_test:update_helper_checklist_test_update_8003',
];
$this
->assertEquals($expected_all_saved_ids, array_keys($all_saved));
/** @var \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_factory */
$key_value_factory = $this->container
->get('keyvalue');
$state = $key_value_factory
->get('state')
->get('checklistapi.progress.update_helper_checklist');
foreach ($expected_all_saved_ids as $update_id) {
$this
->assertNotEmpty($state['#items'][$update_id]);
}
}