RebuildScriptTest.php in Drupal 8
File
core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\UpdateSystem;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class RebuildScriptTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
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'));
}
}