CDispatcherBasicTest::testDispatchWrongRoute1()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 5
rs 9.4285
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