1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OpCacheGUITest\Unit\Presentation; |
4
|
|
|
|
5
|
|
|
use OpCacheGUI\Presentation\Url; |
6
|
|
|
use OpCacheGUI\Network\Router; |
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
|
9
|
|
|
class UrlTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @covers OpCacheGUI\Presentation\Url::__construct |
13
|
|
|
*/ |
14
|
|
|
public function testConstructCorrectInterface() |
15
|
|
|
{ |
16
|
|
|
$url = new Url(Router::URL_REWRITE); |
17
|
|
|
|
18
|
|
|
$this->assertInstanceOf('\\OpCacheGUI\\Presentation\\UrlRenderer', $url); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @covers OpCacheGUI\Presentation\Url::__construct |
23
|
|
|
* @covers OpCacheGUI\Presentation\Url::get |
24
|
|
|
* @covers OpCacheGUI\Presentation\Url::getRewriteUrl |
25
|
|
|
*/ |
26
|
|
|
public function testGetRewriteUrlStatus() |
27
|
|
|
{ |
28
|
|
|
$url = new Url(Router::URL_REWRITE); |
29
|
|
|
|
30
|
|
|
$this->assertSame('..', $url->get('status')); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @covers OpCacheGUI\Presentation\Url::__construct |
35
|
|
|
* @covers OpCacheGUI\Presentation\Url::get |
36
|
|
|
* @covers OpCacheGUI\Presentation\Url::getRewriteUrl |
37
|
|
|
*/ |
38
|
|
|
public function testGetRewriteUrlOther() |
39
|
|
|
{ |
40
|
|
|
$url = new Url(Router::URL_REWRITE); |
41
|
|
|
|
42
|
|
|
$this->assertSame('/other', $url->get('other')); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @covers OpCacheGUI\Presentation\Url::__construct |
47
|
|
|
* @covers OpCacheGUI\Presentation\Url::get |
48
|
|
|
* @covers OpCacheGUI\Presentation\Url::getQueryStringUrl |
49
|
|
|
*/ |
50
|
|
|
public function testGetQueryStringUrlStatus() |
51
|
|
|
{ |
52
|
|
|
$url = new Url(Router::QUERY_STRING); |
53
|
|
|
|
54
|
|
|
$this->assertSame('?', $url->get('status')); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @covers OpCacheGUI\Presentation\Url::__construct |
59
|
|
|
* @covers OpCacheGUI\Presentation\Url::get |
60
|
|
|
* @covers OpCacheGUI\Presentation\Url::getQueryStringUrl |
61
|
|
|
*/ |
62
|
|
|
public function testGetQueryStringUrlOther() |
63
|
|
|
{ |
64
|
|
|
$url = new Url(Router::QUERY_STRING); |
65
|
|
|
|
66
|
|
|
$this->assertSame('?other', $url->get('other')); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|