ContainerRebuildWebTest.php in Drupal 8
File
core/modules/system/tests/src/Functional/DrupalKernel/ContainerRebuildWebTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\DrupalKernel;
use Drupal\Tests\BrowserTestBase;
class ContainerRebuildWebTest extends BrowserTestBase {
public static $modules = [
'service_provider_test',
];
protected $defaultTheme = 'stark';
public function testSetContainerRebuildWithDifferentDeploymentIdentifier() {
$assert = $this
->assertSession();
$this
->drupalGet('<front>');
$assert
->responseHeaderEquals('container_rebuild_indicator', NULL);
$this
->writeSettings([
'settings' => [
'deployment_identifier' => (object) [
'value' => 'new-identifier',
'required' => TRUE,
],
],
]);
$this
->drupalGet('<front>');
$assert
->responseHeaderEquals('container_rebuild_indicator', 'new-identifier');
}
public function testContainerInvalidation() {
$assert = $this
->assertSession();
$this
->drupalGet('<front>');
$assert
->responseHeaderEquals('container_rebuild_test_parameter', NULL);
$this
->writeSettings([
'settings' => [
'container_rebuild_test_parameter' => (object) [
'value' => 'rebuild_me_please',
'required' => TRUE,
],
],
]);
$this
->drupalGet('<front>');
$assert
->responseHeaderEquals('container_rebuild_test_parameter', NULL);
\Drupal::service('kernel')
->invalidateContainer();
$this
->drupalGet('<front>');
$assert
->responseHeaderEquals('container_rebuild_test_parameter', 'rebuild_me_please');
}
}