function RebuildScriptTest::testRebuild

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\RebuildScriptTest::testRebuild()
  2. 10 core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\RebuildScriptTest::testRebuild()
  3. 11.x core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\RebuildScriptTest::testRebuild()

Test redirect in rebuild.php.

File

core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php, line 23

Class

RebuildScriptTest
Tests the rebuild script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testRebuild() {
    $cache = $this->container
        ->get('cache.default');
    $cache->set('rebuild_test', TRUE);
    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));
    $this->assertUrl(new Url('<front>'));
    $this->assertInstanceOf(\stdClass::class, $cache->get('rebuild_test'));
    $settings['settings']['rebuild_access'] = (object) [
        'value' => TRUE,
        'required' => TRUE,
    ];
    $this->writeSettings($settings);
    $this->rebuildAll();
    $cache->set('rebuild_test', TRUE);
    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));
    $this->assertUrl(new Url('<front>'));
    $this->assertFalse($cache->get('rebuild_test'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.