info = $this->getAnnotations(); $this->dir = $this->mockModule('foo'); $this->mockContainer(); $this->mockTranslator(); $this->mockLogger(); $this->initDB(); // At the time of this writing, Target will pull the indexer manager out // of the container right away, so let's mock it. $indexers = $this->getMock('\Drupal\Component\Plugin\PluginManagerInterface'); $this->container->set('plugin.manager.drupalmoduleupgrader.indexer', $indexers); $this->target = new Target($this->dir->url(), $this->container); } /** * Instantiates the plugin class covered by this test (as indicated by the * @covers annotation). The plugin instance is given a randomly generated * ID and description. Dependencies will be pulled from $this->container, * so this should only be called once the mock container is ready. * * @param array $configuration * Additional configuration to pass to the instance. * @param array $plugin_definition * Additional definition info to pass to the instance. * * @return object * A plugin instance. */ protected function getPlugin(array $configuration = [], $plugin_definition = []) { $plugin_definition['description'] = $this->getRandomGenerator()->sentences(4); $class = $this->info['class']['covers'][0]; return $class::create($this->container, $configuration, $this->randomMachineName(), $plugin_definition); } }