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