dir->getChild('foo.module')->setContent($code); $indexer = new Functions([], 'function', [], $this->db, $this->target); $indexer->build(); $this->container ->get('plugin.manager.drupalmoduleupgrader.indexer') ->method('createInstance') ->with('function') ->willReturn($indexer); $this->analyzer = $this->getPlugin([], ['hook' => 'block_info']); } public function test() { $issues = $this->analyzer->analyze($this->target); $this->assertInternalType('array', $issues); $this->assertNotEmpty($issues); $this->assertIssueDefaults($issues[0]); $this->assertCount(1, $issues[0]->getViolations()); } }