You are here

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

Class

PSR4Test
@group DMU.Analyzer @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\PSR4

Namespace

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

Code

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

class FooBaz {}
END;
  $this->dir
    ->getChild('foo.module')
    ->setContent($code);
  $indexer = new Classes([], 'class', [], $this->db, $this->target);
  $indexer
    ->build();
  $this->container
    ->get('plugin.manager.drupalmoduleupgrader.indexer')
    ->method('createInstance')
    ->with('class')
    ->willReturn($indexer);
  $this->analyzer = $this
    ->getPlugin();
}