3 namespace Drupal\Tests\system\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
8 * Tests hook_post_update() when there are failing update hooks.
12 class UpdatePostUpdateFailingTest extends UpdatePathTestBase {
17 protected function setDatabaseDumpFiles() {
18 $this->databaseDumpFiles = [
19 __DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
20 __DIR__ . '/../../../../tests/fixtures/update/drupal-8.update-test-postupdate-failing-enabled.php',
25 * Tests hook_post_update_NAME().
27 public function testPostUpdate() {
28 // There are expected to be failed updates.
29 $this->checkFailedUpdates = FALSE;
33 // There should be no post update hooks registered as being run.
34 $this->assertIdentical([], \Drupal::state()->get('post_update_test_execution', []));
36 $key_value = \Drupal::keyValue('update__post_update');
37 $this->assertEqual([], $key_value->get('existing_updates', []));
43 protected function doSelectionTest() {
44 // First update, should not be run since this module's update hooks fail.
45 $this->assertRaw('8001 - This update will fail.');
46 $this->assertRaw('8002 - A further update.');
47 $this->assertEscaped("First update, should not be run since this module's update hooks fail.");