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