Completed
Push — master ( bff253...2705ab )
by Dmitry
05:49 queued 01:23
created

HttpTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B test() 0 29 1
1
<?php
2
3
namespace Test;
4
5
use Basis\Http;
6
use Controller\Index;
7
8
class HttpTest extends TestSuite
9
{
10
    public function test()
11
    {
12
        $http = $this->app->get(Http::class);
13
14
        // index method
15
        $this->assertSame(['index', 'index'], $http->getChain('/'));
16
        $this->assertSame(['hello', 'index'], $http->getChain('/hello/'));
17
        $this->assertSame(['hello', 'index'], $http->getChain('/hello/////'));
18
        $this->assertSame(['hello', 'nekufa'], $http->getChain('/hello/nekufa'));
19
        $this->assertSame(['hello', 'nekufa'], $http->getChain('/hello/nekufa?querystring'));
20
21
        // class exists
22
        $this->assertTrue(class_exists(Index::class));
23
        $this->assertTrue(method_exists(Index::class, 'index'));
24
25
        // index routing
26
        $this->assertSame('index page', $http->process("/"));
27
        $this->assertSame('index page', $http->process("/index"));
28
        $this->assertSame('index page', $http->process("/index/index"));
29
30
        //
31
        $this->assertSame('url: ', $http->process("/dynamic"));
32
        $this->assertSame('url: ', $http->process("/dynamic/"));
33
        $this->assertSame('url: slug', $http->process("/dynamic/slug"));
34
        $this->assertSame('url: slug/sub', $http->process("/dynamic/slug/sub"));
35
36
        $meta = $this->app->dispatch('module.meta');
37
        $this->assertContains('index/index', $meta['routes']);
38
    }
39
}
40