public function HookPermissionTest::setUp in Drupal 7 to 8/9 Module Upgrader 8
Mocks an entire module, called foo, in a virtual file system.
Overrides TestBase::setUp
File
- tests/
src/ Unit/ Plugin/ DMU/ Analyzer/ HookPermissionTest.php, line 17
Class
- HookPermissionTest
- @group DMU.Analyzer @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\HookPermission
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\AnalyzerCode
public function setUp() {
parent::setUp();
$code = <<<'END'
<?php
/**
* Implements hook_permission().
*/
function foo_permission() {
return array();
}
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);
$this->analyzer = $this
->getPlugin();
}