Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Update / UpdatePathWithBrokenRoutingTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests the update path with a broken router.
9  *
10  * @group Update
11  * @group legacy
12  */
13 class UpdatePathWithBrokenRoutingTest 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.broken_routing.php',
22     ];
23   }
24
25   /**
26    * Tests running update.php with some form of broken routing.
27    */
28   public function testWithBrokenRouting() {
29     // Simulate a broken router, and make sure the front page is
30     // inaccessible.
31     \Drupal::state()->set('update_script_test_broken_inbound', TRUE);
32     \Drupal::service('cache_tags.invalidator')->invalidateTags(['route_match', 'rendered']);
33     $this->drupalGet('<front>');
34     $this->assertResponse(500);
35
36     $this->runUpdates();
37
38     // Remove the simulation of the broken router, and make sure we can get to
39     // the front page again.
40     \Drupal::state()->set('update_script_test_broken_inbound', FALSE);
41     $this->drupalGet('<front>');
42     $this->assertResponse(200);
43   }
44
45 }