3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Fixer;
5 use Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer\PSR4;
6 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
7 use org\bovigo\vfs\vfsStream;
8 use Pharborist\NodeCollection;
9 use Pharborist\Objects\ClassNode;
14 class PSR4Test extends TestBase {
16 public function test() {
17 $class = ClassNode::create('Wambooli');
18 $indexer = $this->getMock('\Drupal\drupalmoduleupgrader\IndexerInterface');
19 $indexer->method('get')->with('Wambooli')->willReturn(new NodeCollection([ $class ]));
23 ->get('plugin.manager.drupalmoduleupgrader.indexer')
24 ->method('createInstance')
26 ->willReturn($indexer);
29 'source' => 'Wambooli',
30 'destination' => 'Drupal\foo\Wambooli',
32 $plugin = new PSR4($config, uniqID(), []);
33 $plugin->setTarget($this->target);
36 $url = $this->target->getPath('src/Wambooli.php');
37 $this->assertFileExists($url);