|
@@ 11-23 (lines=13) @@
|
| 8 |
|
*/ |
| 9 |
|
class RelativeNamespaceDiscoveryTest extends \Codeception\Test\Unit |
| 10 |
|
{ |
| 11 |
|
public function testGetClasses() |
| 12 |
|
{ |
| 13 |
|
$classLoader = new ClassLoader(); |
| 14 |
|
$classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__.'/../../plugins')]); |
| 15 |
|
$service = new RelativeNamespaceDiscovery($classLoader); |
| 16 |
|
$service->setRelativeNamespace('Robo\Plugin'); |
| 17 |
|
$service->setSearchPattern('*Commands.php'); |
| 18 |
|
$classes = $service->getClasses(); |
| 19 |
|
|
| 20 |
|
$this->assertContains('\Robo\PluginTest\Robo\Plugin\Commands\FirstCustomCommands', $classes); |
| 21 |
|
$this->assertContains('\Robo\PluginTest\Robo\Plugin\Commands\SecondCustomCommands', $classes); |
| 22 |
|
$this->assertNotContains('\Robo\PluginTest\Robo\Plugin\Commands\NotValidClassName', $classes); |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
public function testGetFile() |
| 26 |
|
{ |
|
@@ 25-37 (lines=13) @@
|
| 22 |
|
$this->assertNotContains('\Robo\PluginTest\Robo\Plugin\Commands\NotValidClassName', $classes); |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
public function testGetFile() |
| 26 |
|
{ |
| 27 |
|
$classLoader = new ClassLoader(); |
| 28 |
|
$classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__.'/../../plugins')]); |
| 29 |
|
$service = new RelativeNamespaceDiscovery($classLoader); |
| 30 |
|
$service->setRelativeNamespace('Robo\Plugin'); |
| 31 |
|
|
| 32 |
|
$actual = $service->getFile('\Robo\PluginTest\Robo\Plugin\Commands\FirstCustomCommands'); |
| 33 |
|
$this->assertStringEndsWith('FirstCustomCommands.php', $actual); |
| 34 |
|
|
| 35 |
|
$actual = $service->getFile('\Robo\PluginTest\Robo\Plugin\Commands\SecondCustomCommands'); |
| 36 |
|
$this->assertStringEndsWith('SecondCustomCommands.php', $actual); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
/** |
| 40 |
|
* @dataProvider testConvertPathToNamespaceData |