Commit a3270cd3 authored by alexpott's avatar alexpott

Issue #2575267 by webflo, kgoel, voleger, MerryHamster, hussainweb, Mile23:...

Issue #2575267 by webflo, kgoel, voleger, MerryHamster, hussainweb, Mile23: Add test coverage for rebuild.php
parent 8e678056
<?php
namespace Drupal\Tests\system\Functional\Update;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the rebuild script access and functionality.
*
* @group Rebuild
*/
class RebuildScriptTest extends BrowserTestBase {
/**
* Test redirect in rebuild.php.
*/
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->assertTrue($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'));
}
}
......@@ -54,4 +54,4 @@
\Drupal::messenger()->addStatus('Cache rebuild complete.');
}
$base_path = dirname(dirname($request->getBaseUrl()));
header('Location: ' . $base_path);
header('Location: ' . $request->getSchemeAndHttpHost() . $base_path);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment