3 namespace Drupal\system\Tests\Update;
6 * Tests the update path with a broken router.
10 class UpdatePathWithBrokenRoutingTest extends UpdatePathTestBase {
15 protected function setDatabaseDumpFiles() {
16 $this->databaseDumpFiles = [
17 __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
18 __DIR__ . '/../../../tests/fixtures/update/drupal-8.broken_routing.php',
23 * Tests running update.php with some form of broken routing.
25 public function testWithBrokenRouting() {
26 // Simulate a broken router, and make sure the front page is
28 \Drupal::state()->set('update_script_test_broken_inbound', TRUE);
29 \Drupal::service('cache_tags.invalidator')->invalidateTags(['route_match', 'rendered']);
30 $this->drupalGet('<front>');
31 $this->assertResponse(500);
33 // The exceptions are expected. Do not interpret them as a test failure.
34 // Not using File API; a potential error must trigger a PHP warning.
35 unlink(\Drupal::root() . '/' . $this->siteDirectory . '/error.log');
36 foreach ($this->assertions as $key => $assertion) {
37 if (strpos($assertion['message'], 'core/modules/system/tests/modules/update_script_test/src/PathProcessor/BrokenInboundPathProcessor.php') !== FALSE) {
38 unset($this->assertions[$key]);
39 $this->deleteAssert($assertion['message_id']);
45 // Remove the simulation of the broken router, and make sure we can get to
46 // the front page again.
47 \Drupal::state()->set('update_script_test_broken_inbound', FALSE);
48 $this->drupalGet('<front>');
49 $this->assertResponse(200);