CacheabilityMetadataConfigOverrideIntegrationTest.php in Drupal 8
File
core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php
View source
<?php
namespace Drupal\Tests\config\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
class CacheabilityMetadataConfigOverrideIntegrationTest extends BrowserTestBase {
use AssertPageCacheContextsAndTagsTrait;
public static $modules = [
'block_test',
'config_override_integration_test',
];
protected $defaultTheme = 'classy';
protected function setUp() {
parent::setUp();
\Drupal::state()
->set('block_test.content', 'Needs to have some content');
$this
->drupalLogin($this
->drupalCreateUser());
}
public function testConfigOverride() {
$this
->drupalGet('<front>');
$this
->assertNoText('Overridden block label');
$this
->assertCacheContext('config_override_integration_test');
$this
->assertCacheTag('config_override_integration_test_tag');
\Drupal::state()
->set('config_override_integration_test.enabled', TRUE);
$this
->drupalGet('<front>');
$this
->assertText('Overridden block label');
$this
->assertCacheContext('config_override_integration_test');
$this
->assertCacheTag('config_override_integration_test_tag');
}
}