@@ 81-92 (lines=12) @@ | ||
78 | * @covers Tight\Router::get |
|
79 | * @covers Tight\Router::__construct |
|
80 | */ |
|
81 | public function testRouterGet() { |
|
82 | $output = ""; |
|
83 | $this->router->dispatch("/hello/", "get"); |
|
84 | $this->expectOutputString("Hello"); |
|
85 | $output .= "Hello"; |
|
86 | $this->router->dispatch("/hello/", "post"); |
|
87 | $this->expectOutputString($output . "Page not found"); |
|
88 | $output .= "Page not found"; |
|
89 | $this->router->dispatch("/hello/world", "get"); |
|
90 | $this->expectOutputString($output . "Hello world"); |
|
91 | $output.="Hello world"; |
|
92 | } |
|
93 | ||
94 | /** |
|
95 | * @test |
|
@@ 99-110 (lines=12) @@ | ||
96 | * @covers Tight\Router::post |
|
97 | * @covers Tight\Router::dispatch |
|
98 | */ |
|
99 | public function testRouterPost() { |
|
100 | $output = ""; |
|
101 | $this->router->dispatch("/world/", "post"); |
|
102 | $this->expectOutputString($output . "world"); |
|
103 | $output .= "world"; |
|
104 | $this->router->dispatch("/world/", "get"); |
|
105 | $this->expectOutputString($output . "Page not found"); |
|
106 | $output .= "Page not found"; |
|
107 | $this->router->dispatch("/world/hello", "post"); |
|
108 | $this->expectOutputString($output . "hello world"); |
|
109 | $output .= "Hello world"; |
|
110 | } |
|
111 | ||
112 | /** |
|
113 | * @test |
|
@@ 118-129 (lines=12) @@ | ||
115 | * @covers Tight\Router::url |
|
116 | * @covers Tight\Router::dispatch |
|
117 | */ |
|
118 | public function testRouterMap() { |
|
119 | $output = ""; |
|
120 | $this->router->dispatch("/map/", "post"); |
|
121 | $this->expectOutputString($output . "map"); |
|
122 | $output .= "map"; |
|
123 | $this->router->dispatch("/map/", "get"); |
|
124 | $this->expectOutputString($output . "map"); |
|
125 | $output .= "map"; |
|
126 | $this->router->dispatch("/map/", "options"); |
|
127 | $this->expectOutputString($output . "Page not found"); |
|
128 | $output .= "Page not found"; |
|
129 | } |
|
130 | ||
131 | /** |
|
132 | * @test |