route.test.php 916 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. class RouteTest extends PHPUnit_Framework_TestCase {
  3. /**
  4. * Destroy the testing environment.
  5. */
  6. public function tearDown()
  7. {
  8. Request::$route = null;
  9. }
  10. /**
  11. * Tests the Route::handles method.
  12. *
  13. * @group laravel
  14. */
  15. public function testHandlesIndicatesIfTheRouteHandlesAGivenURI()
  16. {
  17. $route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /foo/bar')));
  18. $this->assertTrue($route->handles('foo/*'));
  19. $this->assertTrue($route->handles('foo/bar'));
  20. $this->assertFalse($route->handles('/'));
  21. $this->assertFalse($route->handles('baz'));
  22. $this->assertFalse($route->handles('/foo'));
  23. $this->assertFalse($route->handles('foo'));
  24. $route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
  25. $this->assertTrue($route->handles('/'));
  26. $this->assertTrue($route->handles('home'));
  27. $this->assertFalse($route->handles('foo'));
  28. }
  29. }