Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Update / UpdatePostUpdateFailingTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests hook_post_update() when there are failing update hooks.
9  *
10  * @group Update
11  * @group legacy
12  */
13 class UpdatePostUpdateFailingTest extends UpdatePathTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
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',
22     ];
23   }
24
25   /**
26    * Tests hook_post_update_NAME().
27    */
28   public function testPostUpdate() {
29     // There are expected to be failed updates.
30     $this->checkFailedUpdates = FALSE;
31
32     $this->runUpdates();
33
34     // There should be no post update hooks registered as being run.
35     $this->assertIdentical([], \Drupal::state()->get('post_update_test_execution', []));
36
37     $key_value = \Drupal::keyValue('update__post_update');
38     $this->assertEqual([], $key_value->get('existing_updates', []));
39   }
40
41   /**
42    * {@inheritdoc}
43    */
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.");
49   }
50
51 }