Tests CacheDecorator::clearCachedDefinitions().
public function testClearCachedDefinitions() {
$cache = cache($this->cacheBin);
// Populate the caches by collecting definitions once.
$this->discovery
->getDefinitions();
// Add a new definition.
$this->expectedDefinitions['banana'] = array(
'label' => 'Banana',
'color' => 'yellow',
);
$this->discovery
->setDefinition('banana', $this->expectedDefinitions['banana']);
// Check that the new definition is not found.
$definition = $this->discovery
->getDefinition('banana');
$this
->assertNull($definition, 'Newly added definition is not found.');
// Clear cached definitions, and check that the new definition is found.
$this->discovery
->clearCachedDefinitions();
$cached = $cache
->get($this->cacheKey);
$this
->assertIdentical($cached, FALSE, 'Cache is empty.');
$definitions = $this->discovery
->getDefinitions();
$this
->assertIdentical($definitions, $this->expectedDefinitions, 'Newly added definition is found.');
}