コード例 #1
0
ファイル: SimpleRouteTest.php プロジェクト: brick/app
 /**
  * @dataProvider providerRoute
  *
  * @param string $path   The request path.
  * @param string $class  The expected controller class.
  * @param string $method The expected controller method.
  */
 public function testRoute($path, $class, $method)
 {
     $request = new Request();
     $request->setPath($path);
     $route = new SimpleRoute(['/' => \name\space\IndexController::class, '/foo/' => \name\space\FooController::class, '/foo/bar/' => \name\space\Foo\BarController::class]);
     $match = $route->match($request);
     $this->assertInstanceOf(RouteMatch::class, $match);
     $reflection = $match->getControllerReflection();
     $this->assertInstanceOf(\ReflectionMethod::class, $reflection);
     /** @var \ReflectionMethod $reflection */
     $this->assertSame($class, $reflection->getDeclaringClass()->getName());
     $this->assertSame($method, $reflection->getName());
 }
コード例 #2
0
ファイル: RequestTest.php プロジェクト: brick/http
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testSetPathThrowsExceptionWhenPathIsInvalid()
 {
     $request = new Request();
     $request->setPath('/user/edit?user=123');
 }