getMock('\Drupal\drupalmoduleupgrader\IndexerInterface'); $indexer->method('get')->with('Wambooli')->willReturn(new NodeCollection([ $class ])); $this ->container ->get('plugin.manager.drupalmoduleupgrader.indexer') ->method('createInstance') ->with('class') ->willReturn($indexer); $config = [ 'source' => 'Wambooli', 'destination' => 'Drupal\foo\Wambooli', ]; $plugin = new PSR4($config, uniqID(), []); $plugin->setTarget($this->target); $plugin->execute(); $url = $this->target->getPath('src/Wambooli.php'); $this->assertFileExists($url); } }