GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 5cfb1d...ad8ac9 )
by Omid
02:43
created

RoutingTest::setUp()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 16
Code Lines 10

Duplication

Lines 16
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 16
loc 16
rs 9.4285
cc 3
eloc 10
nc 4
nop 0
1
<?php
2
3
namespace Rad\Routing\Tests;
4
5
use App\AppBundle;
6
use Composer\Autoload\ClassLoader;
7
use PHPUnit_Framework_TestCase;
8
use Rad\Core\Bundles;
9
use Rad\Routing\Router;
10
use Test\TestBundle;
11
12
/**
13
 * Config Test
14
 *
15
 * @package Rad\Configure\Tests
16
 */
17
class RoutingTest extends PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @var Router
21
     */
22
    private $router;
23
24
    public static function setUpBeforeClass()
25
    {
26
        $classLoader = new ClassLoader();
27
        $classLoader->addPsr4('App\\', __DIR__ . '/Fixtures/src/App');
28
        $classLoader->addPsr4('Test\\', __DIR__ . '/Fixtures/src/Test');
29
        $classLoader->register();
30
    }
31
32 View Code Duplication
    protected function setUp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        $this->router = new Router();
35
        if (!defined('SRC_DIR')) {
36
            define('SRC_DIR', __DIR__ . '/Fixtures/src');
37
        }
38
        if (!defined('DS')) {
39
            define('DS', '/');
40
        }
41
42
        $bundles = [
43
            new AppBundle(),
44
            new TestBundle()
45
        ];
46
        Bundles::loadAll($bundles);
47
    }
48
49
    /**
50
     * Test root URL handler behaviours
51
     */
52 View Code Duplication
    public function testRootUrlHandler()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
53
    {
54
        $this->router->handle('/');
55
56
        $this->assertEquals($this->router->getActionNamespace(), 'App\Action\IndexAction');
57
        $this->assertEquals($this->router->getResponderNamespace(), 'App\Responder\IndexResponder');
58
        $this->assertEquals($this->router->getAction(), 'index');
59
        $this->assertEquals($this->router->getBundle(), 'app');
60
        //$this->assertEquals($this->router->getParams(), []);
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
61
    }
62
63
    /**
64
     * Test bundle only URL handler behaviours
65
     */
66 View Code Duplication
    public function testBundleUrlHandler()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68
        $this->router->handle('/test/');
69
70
        $this->assertEquals($this->router->getActionNamespace(), 'Test\Action\IndexAction');
71
        $this->assertEquals($this->router->getResponderNamespace(), 'Test\Responder\IndexResponder');
72
        $this->assertEquals($this->router->getAction(), 'index');
73
        $this->assertEquals($this->router->getBundle(), 'test');
74
        //$this->assertEquals($this->router->getParams(), []);
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
75
    }
76
77
    /**
78
     * Test bundle with method URL handler behaviours
79
     */
80 View Code Duplication
    public function testBundleMethodUrlHandler()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
81
    {
82
        $this->router->handle('/test/method/');
83
84
        $this->assertEquals($this->router->getActionNamespace(), 'Test\Action\Method\CliMethodAction');
85
        $this->assertEquals($this->router->getResponderNamespace(), 'Test\Responder\Method\CliMethodResponder');
86
        $this->assertEquals($this->router->getAction(), 'CliMethod');
87
        $this->assertEquals($this->router->getBundle(), 'test');
88
        //$this->assertEquals($this->router->getParams(), []);
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
89
    }
90
91
    /**
92
     * Test bundle and action URL handler behaviours
93
     */
94 View Code Duplication
    public function testBundleActionUrlHandler()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
95
    {
96
        $this->router->handle('/test/test/');
97
98
        $this->assertEquals($this->router->getActionNamespace(), 'Test\Action\TestAction');
99
        $this->assertEquals($this->router->getResponderNamespace(), 'Test\Responder\TestResponder');
100
        $this->assertEquals($this->router->getAction(), 'test');
101
        $this->assertEquals($this->router->getBundle(), 'test');
102
        //$this->assertEquals($this->router->getParams(), []);
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
103
    }
104
105
    /**
106
     * Test bundle and action and params URL handler behaviours
107
     */
108 View Code Duplication
    public function testBundleActionParamsUrlHandler()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
109
    {
110
        $this->router->handle('/test/test/param1/param2/');
111
112
        $this->assertEquals($this->router->getActionNamespace(), 'Test\Action\TestAction');
113
        $this->assertEquals($this->router->getResponderNamespace(), 'Test\Responder\TestResponder');
114
        $this->assertEquals($this->router->getAction(), 'test');
115
        $this->assertEquals($this->router->getBundle(), 'test');
116
        //$this->assertEquals($this->router->getParams(), ['param1', 'param2']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
117
    }
118
}
119