Passed
Push — master ( 8c0b29...3c21da )
by Mike
02:50
created

FacadeTest::testHydrateCommandsNotRecusive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
dl 11
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace NexusTest\CustomCommand;
3
4
use Nexus\CustomCommand\Command\TestRecursiveCommand;
5
use Xervice\Core\Locator\Locator;
6
use XerviceTest\Console\Command\TestCommand;
7
8
class FacadeTest extends \Codeception\Test\Unit
9
{
10
    /**
11
     * @var \Nexus\CustomCommand\CustomCommandFacade
12
     */
13
    private $facade;
14
15
    protected function _before()
16
    {
17
        $this->facade = Locator::getInstance()->customCommand()->facade();
18
    }
19
20
    /**
21
     * @group Nexus
22
     * @group CustomCommand
23
     * @group Facade
24
     * @group Integration
25
     */
26
    public function testHydrateCommandsRecusive()
27
    {
28
        $commands = $this->facade->hydrateCommands([], __DIR__ . '/test', true);
29
30
        $this->assertCount(2, $commands);
31
32
        $this->assertInstanceOf(
33
            'Nexus\\CustomCommand\\Command\\TestCommand',
34
            $commands[0]
35
        );
36
        $this->assertInstanceOf(
37
            'Nexus\\CustomCommand\\Command\\TestRecursiveCommand',
38
            $commands[1]
39
        );
40
    }
41
42
    /**
43
     * @group Nexus
44
     * @group CustomCommand
45
     * @group Facade
46
     * @group Integration
47
     */
48
    public function testHydrateCommandsNotRecusive()
49
    {
50
        $commands = $this->facade->hydrateCommands([], __DIR__ . '/test', false);
51
52
        $this->assertCount(1, $commands);
53
54
        $this->assertInstanceOf(
55
            'Nexus\\CustomCommand\\Command\\TestCommand',
56
            $commands[0]
57
        );
58
    }
59
60
    /**
61
     * @group Nexus
62
     * @group CustomCommand
63
     * @group Facade
64
     * @group Integration
65
     */
66
    public function testHydrateCommandsWithNonExistingDirectory()
67
    {
68
        $commands = $this->facade->hydrateCommands([], __DIR__ . '/notExisting', false);
69
70
        $this->assertCount(0, $commands);
71
    }
72
}