Chris@14: [$discovery_path]]); Chris@14: $this->assertEquals([ Chris@14: 'discovery_test_1' => [ Chris@14: 'id' => 'discovery_test_1', Chris@14: 'class' => 'com\example\PluginNamespace\DiscoveryTest1', Chris@14: ], Chris@14: ], $discovery->getDefinitions()); Chris@14: Chris@14: // Gain access to the file cache so we can change it. Chris@14: $ref_file_cache = new \ReflectionProperty($discovery, 'fileCache'); Chris@14: $ref_file_cache->setAccessible(TRUE); Chris@14: /* @var $file_cache \Drupal\Component\FileCache\FileCacheInterface */ Chris@14: $file_cache = $ref_file_cache->getValue($discovery); Chris@14: // The file cache is keyed by the file path, and we'll add some known Chris@14: // content to test against. Chris@14: $file_cache->set($file_path, [ Chris@14: 'id' => 'wrong_id', Chris@14: 'content' => serialize(['an' => 'array']), Chris@14: ]); Chris@14: Chris@14: // Now perform the same query and check for the cached results. Chris@14: $this->assertEquals([ Chris@14: 'wrong_id' => [ Chris@14: 'an' => 'array', Chris@14: ], Chris@14: ], $discovery->getDefinitions()); Chris@14: } Chris@14: Chris@14: }