public function CacheabilityMetadataConfigOverrideIntegrationTest::testConfigOverride in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideIntegrationTest.php \Drupal\config\Tests\CacheabilityMetadataConfigOverrideIntegrationTest::testConfigOverride()
Tests if config overrides correctly set cacheability metadata.
File
- core/
modules/ config/ src/ Tests/ CacheabilityMetadataConfigOverrideIntegrationTest.php, line 44 - Contains \Drupal\config\Tests\CacheabilityMetadataConfigOverrideIntegrationTest.
Class
- CacheabilityMetadataConfigOverrideIntegrationTest
- Tests if configuration overrides correctly affect cacheability metadata.
Namespace
Drupal\config\TestsCode
public function testConfigOverride() {
// Check the default (disabled) state of the cache context. The block label
// should not be overridden.
$this
->drupalGet('<front>');
$this
->assertNoText('Overridden block label');
// Both the cache context and tag should be present.
$this
->assertCacheContext('config_override_integration_test');
$this
->assertCacheTag('config_override_integration_test_tag');
// Flip the state of the cache context. The block label should now be
// overridden.
\Drupal::state()
->set('config_override_integration_test.enabled', TRUE);
$this
->drupalGet('<front>');
$this
->assertText('Overridden block label');
// Both the cache context and tag should still be present.
$this
->assertCacheContext('config_override_integration_test');
$this
->assertCacheTag('config_override_integration_test_tag');
}