array( 'title' => 'Do snazzy bazzy things', ), ); } END; $this->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); $config = [ 'type' => 'function', 'id' => 'hook_permission', ]; $plugin = new Delete($config, uniqid(), []); $plugin->setTarget($this->target); $plugin->execute(); $this->assertFalse($indexer->has('permission')); $this->assertEquals("dir->getChild('foo.module')->getContent()); } }