|
@@ 263-276 (lines=14) @@
|
| 260 |
|
/** |
| 261 |
|
* Test that the namespace is matched to the handler and returned. |
| 262 |
|
*/ |
| 263 |
|
public function testFindHandlerNamespace(){ |
| 264 |
|
|
| 265 |
|
$routeCollection = new RouteCollection(); |
| 266 |
|
$routeCollection->addNamespace('\Rs\Router'); |
| 267 |
|
|
| 268 |
|
$handler = 'RouteCollection::addRoute'; |
| 269 |
|
$expected = '\\Rs\\Router\\RouteCollection::addRoute'; |
| 270 |
|
|
| 271 |
|
$reflectionMethod = new \ReflectionMethod(RouteCollection::class, '_findHandlerNamespace'); |
| 272 |
|
$reflectionMethod->setAccessible(true); |
| 273 |
|
$actual = $reflectionMethod->invoke($routeCollection, $handler); |
| 274 |
|
|
| 275 |
|
$this->assertEquals($expected,$actual); |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
/** |
| 279 |
|
* Test that backlash is added to start of namespace on response. |
|
@@ 281-294 (lines=14) @@
|
| 278 |
|
/** |
| 279 |
|
* Test that backlash is added to start of namespace on response. |
| 280 |
|
*/ |
| 281 |
|
public function testFindHandlerNamespaceNoBacklash(){ |
| 282 |
|
|
| 283 |
|
$routeCollection = new RouteCollection(); |
| 284 |
|
$routeCollection->addNamespace('Rs\Router'); |
| 285 |
|
|
| 286 |
|
$handler = 'RouteCollection::addRoute'; |
| 287 |
|
$expected = '\\Rs\\Router\\RouteCollection::addRoute'; |
| 288 |
|
|
| 289 |
|
$reflectionMethod = new \ReflectionMethod(RouteCollection::class, '_findHandlerNamespace'); |
| 290 |
|
$reflectionMethod->setAccessible(true); |
| 291 |
|
$actual = $reflectionMethod->invoke($routeCollection, $handler); |
| 292 |
|
|
| 293 |
|
$this->assertEquals($expected,$actual); |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
} |
| 297 |
|
|