SymfonyCliTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 31
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testMatching() 0 7 1
A testMatchingWithParams() 0 7 1
A testNotMatching() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModuleTest\Mvc\Router\Console;
6
7
use DoctrineModule\Mvc\Router\Console\SymfonyCli;
8
use Laminas\Console\Request;
9
use Laminas\Router\RouteMatch;
10
use PHPUnit\Framework\TestCase;
11
use Symfony\Component\Console\Application;
12
13
/**
14
 * Tests for {@see \DoctrineModule\Mvc\Router\Console\SymfonyCli}
15
 *
16
 * @covers \DoctrineModule\Mvc\Router\Console\SymfonyCli
17
 */
18
class SymfonyCliTest extends TestCase
19
{
20
    /** @var SymfonyCli */
21
    protected $route;
22
23
    protected function setUp() : void
24
    {
25
        $this->route = new SymfonyCli(new Application());
26
    }
27
28
    public function testMatching() : void
29
    {
30
        $this->assertInstanceOf(
31
            RouteMatch::class,
32
            $this->route->match(new Request(['scriptname.php', 'list']))
33
        );
34
    }
35
36
    public function testMatchingWithParams() : void
37
    {
38
        $this->assertInstanceOf(
39
            RouteMatch::class,
40
            $this->route->match(new Request(['scriptname.php', 'list', '--help']))
41
        );
42
    }
43
44
    public function testNotMatching() : void
45
    {
46
        $this->assertNull($this->route->match(new Request(['scriptname.php', 'unknowncommand'])));
47
    }
48
}
49