public function UpdatePathWithBrokenRoutingTest::testWithBrokenRouting in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Update/UpdatePathWithBrokenRoutingTest.php \Drupal\system\Tests\Update\UpdatePathWithBrokenRoutingTest::testWithBrokenRouting()
Tests running update.php with some form of broken routing.
File
- core/
modules/ system/ src/ Tests/ Update/ UpdatePathWithBrokenRoutingTest.php, line 30 - Contains \Drupal\system\Tests\Update\UpdatePathWithBrokenRoutingTest.
Class
- UpdatePathWithBrokenRoutingTest
- Tests the update path with a broken router.
Namespace
Drupal\system\Tests\UpdateCode
public function testWithBrokenRouting() {
// Simulate a broken router, and make sure the front page is
// inaccessible.
\Drupal::state()
->set('update_script_test_broken_inbound', TRUE);
\Drupal::service('cache_tags.invalidator')
->invalidateTags([
'route_match',
'rendered',
]);
$this
->drupalGet('<front>');
$this
->assertResponse(500);
// The exceptions are expected. Do not interpret them as a test failure.
// Not using File API; a potential error must trigger a PHP warning.
unlink(\Drupal::root() . '/' . $this->siteDirectory . '/error.log');
foreach ($this->assertions as $key => $assertion) {
if (strpos($assertion['message'], 'core/modules/system/tests/modules/update_script_test/src/PathProcessor/BrokenInboundPathProcessor.php') !== FALSE) {
unset($this->assertions[$key]);
$this
->deleteAssert($assertion['message_id']);
}
}
$this
->runUpdates();
// Remove the simulation of the broken router, and make sure we can get to
// the front page again.
\Drupal::state()
->set('update_script_test_broken_inbound', FALSE);
$this
->drupalGet('<front>');
$this
->assertResponse(200);
}