Chris@0: set('block_test.content', 'Needs to have some content'); Chris@0: Chris@0: $this->drupalLogin($this->drupalCreateUser()); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests if config overrides correctly set cacheability metadata. Chris@0: */ Chris@0: public function testConfigOverride() { Chris@0: // Check the default (disabled) state of the cache context. The block label Chris@0: // should not be overridden. Chris@0: $this->drupalGet(''); Chris@0: $this->assertNoText('Overridden block label'); Chris@0: Chris@0: // Both the cache context and tag should be present. Chris@0: $this->assertCacheContext('config_override_integration_test'); Chris@0: $this->assertCacheTag('config_override_integration_test_tag'); Chris@0: Chris@0: // Flip the state of the cache context. The block label should now be Chris@0: // overridden. Chris@0: \Drupal::state()->set('config_override_integration_test.enabled', TRUE); Chris@0: $this->drupalGet(''); Chris@0: $this->assertText('Overridden block label'); Chris@0: Chris@0: // Both the cache context and tag should still be present. Chris@0: $this->assertCacheContext('config_override_integration_test'); Chris@0: $this->assertCacheTag('config_override_integration_test_tag'); Chris@0: } Chris@0: Chris@0: }