ConfigOverrideIntegrationTestCacheContext.php in Drupal 8
File
core/modules/config/tests/config_override_integration_test/src/Cache/ConfigOverrideIntegrationTestCacheContext.php
View source
<?php
namespace Drupal\config_override_integration_test\Cache;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\CacheContextInterface;
class ConfigOverrideIntegrationTestCacheContext implements CacheContextInterface {
public static function getLabel() {
return t('Config override integration test');
}
public function getContext() {
$state = \Drupal::state()
->get('config_override_integration_test.enabled', FALSE) ? 'yes' : 'no';
return 'config_override_integration_test.' . $state;
}
public function getCacheableMetadata() {
$metadata = new CacheableMetadata();
$metadata
->setCacheMaxAge(0);
return $metadata;
}
}