route.test.php 823 B

12345678910111213141516171819202122232425262728293031323334
  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->assertFalse($route->handles('/'));
  19. $this->assertFalse($route->handles('baz'));
  20. $this->assertTrue($route->handles('foo/*'));
  21. $this->assertTrue($route->handles('foo/bar'));
  22. $route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
  23. $this->assertTrue($route->handles('/'));
  24. $this->assertTrue($route->handles('home'));
  25. $this->assertFalse($route->handles('foo'));
  26. }
  27. }