[vfsStream::url('root/DrupalTest')]], '\\DrupalTest\\Component\\Annotation\\' ); // Register our class loader which will fail if the annotation reader tries // to autoload disallowed annotations. $class_loader = function ($class_name) use ($annotation) { $name_array = explode('\\', $class_name); $name = array_pop($name_array); if ($name == $annotation) { $this->fail('Attempted to autoload a non-plugin annotation: ' . $name); } }; spl_autoload_register($class_loader, TRUE, TRUE); // Now try to get plugin definitions. $definitions = $discovery->getDefinitions(); // Unregister to clean up. spl_autoload_unregister($class_loader); // Assert that no annotations were loaded. $this->assertEmpty($definitions); } }