Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / tests / src / Unit / Plugin / DMU / Fixer / PSR4Test.php
1 <?php
2
3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Fixer;
4
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;
10
11 /**
12  * @group DMU.Fixer
13  */
14 class PSR4Test extends TestBase {
15
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 ]));
20
21     $this
22       ->container
23       ->get('plugin.manager.drupalmoduleupgrader.indexer')
24       ->method('createInstance')
25       ->with('class')
26       ->willReturn($indexer);
27
28     $config = [
29       'source' => 'Wambooli',
30       'destination' => 'Drupal\foo\Wambooli',
31     ];
32     $plugin = new PSR4($config, uniqID(), []);
33     $plugin->setTarget($this->target);
34     $plugin->execute();
35
36     $url = $this->target->getPath('src/Wambooli.php');
37     $this->assertFileExists($url);
38   }
39
40 }