You are here

public function FlagHookTest::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/FlagHookTest.php, line 13

Class

FlagHookTest
@group DMU.Analyzer @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\FlagHook

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Analyzer

Code

public function setUp() {
  parent::setUp();
  $code = <<<'END'
<?php

/**
 * Implements hook_block_info().
 */
function foo_block_info() {
  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([], [
    'hook' => 'block_info',
  ]);
}