|
@@ 140-149 (lines=10) @@
|
| 137 |
|
/** |
| 138 |
|
* @covers Router::generate |
| 139 |
|
*/ |
| 140 |
|
public function testGenerate() |
| 141 |
|
{ |
| 142 |
|
$params1 = ['controller' => 'test', 'action' => 'someaction']; |
| 143 |
|
$params2 = ['controller' => 'test', 'action' => 'someaction', 'type' => 'json']; |
| 144 |
|
|
| 145 |
|
$this->router->map('GET', '/[:controller]/[:action]', $this->closure, 'foo_route'); |
| 146 |
|
|
| 147 |
|
$this->assertEquals('/test/someaction', $this->router->generate('foo_route', $params1)); |
| 148 |
|
$this->assertEquals('/test/someaction', $this->router->generate('foo_route', $params2)); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
/** |
| 152 |
|
* @covers Router::generate |
|
@@ 154-163 (lines=10) @@
|
| 151 |
|
/** |
| 152 |
|
* @covers Router::generate |
| 153 |
|
*/ |
| 154 |
|
public function testGenerateWithOptionalUrlParts() |
| 155 |
|
{ |
| 156 |
|
$params1 = ['controller' => 'test', 'action' => 'someaction']; |
| 157 |
|
$params2 = ['controller' => 'test', 'action' => 'someaction', 'type' => 'json']; |
| 158 |
|
|
| 159 |
|
$this->router->map('GET', '/[:controller]/[:action].[:type]?', $this->closure, 'bar_route'); |
| 160 |
|
|
| 161 |
|
$this->assertEquals('/test/someaction', $this->router->generate('bar_route', $params1)); |
| 162 |
|
$this->assertEquals('/test/someaction.json', $this->router->generate('bar_route', $params2)); |
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
/** |
| 166 |
|
* @covers Router::generate |