CDispatcherBasicTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 37
rs 10
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDispatchWrongRoute1() 0 5 1
A testDispatchWrongRoute2() 0 10 1
1
<?php
2
3
namespace Anax\MVC;
4
5
/**
6
 * A container for routes.
7
 *
8
 */
9
class CDispatcherBasicTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * Test 
13
     *
14
     * @return void
15
     *
16
     * @expectedException Exception
17
     *
18
     */
19
    public function testDispatchWrongRoute1()
20
    {
21
        $disp = new \Anax\MVC\CDispatcherBasic();
22
        $disp->dispatch();
23
    }
24
25
26
27
    /**
28
     * Test 
29
     *
30
     * @return void
31
     *
32
     * @expectedException Exception
33
     *
34
     */
35
    public function testDispatchWrongRoute2()
36
    {
37
        $di = new \Anax\DI\CDI();
38
        $disp = new \Anax\MVC\CDispatcherBasic();
39
        $disp->setDI($di);
0 ignored issues
show
Documentation introduced by
$di is of type object<Anax\DI\CDI>, but the function expects a object<Anax\DI\class>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
40
41
        $disp->setControllerName('not-exists');
42
        $disp->setActionName('not-exists');
43
        $disp->dispatch();
44
    }
45
}
46