/**
  * @covers ::useCaches
  */
 public function testUseCachesWithCachedDecoratedDiscovery()
 {
     $this->decoratedDiscovery = $this->getMockForAbstractClass(PluginDiscoveryDecoratorTestCachedDiscovery::class);
     $this->sut = new PluginDiscoveryDecorator($this->decoratedDiscovery);
     $this->decoratedDiscovery->expects($this->once())->method('clearCachedDefinitions');
     $this->decoratedDiscovery->expects($this->exactly(3))->method('getDefinitions')->willReturn([]);
     // There are no cached definitions yet, so this should call the decorated
     // discovery.
     $this->sut->getDefinitions();
     // This should return the cached definitions.
     $this->sut->getDefinitions();
     $this->sut->useCaches(FALSE);
     // This should return newly built definitions, so this should call the
     // decorated discovery.
     $this->sut->getDefinitions();
     // This should return newly built definitions again, because we disabled
     // caching.
     $this->sut->getDefinitions();
 }