Browse Source

added request tests.

Taylor Otwell 13 years ago
parent
commit
f2b9d1e2f8
2 changed files with 12 additions and 1 deletions
  1. 1 1
      laravel/request.php
  2. 11 0
      tests/Cases/RequestTest.php

+ 1 - 1
laravel/request.php

@@ -42,7 +42,7 @@ class Request {
 		{
 			$uri = $_SERVER['PATH_INFO'];
 		}
-		if (isset($_SERVER['REQUEST_URI']))
+		elseif (isset($_SERVER['REQUEST_URI']))
 		{
 			$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
 

+ 11 - 0
tests/Cases/RequestTest.php

@@ -0,0 +1,11 @@
+<?php
+
+class RequestTest extends PHPUnit_Framework_TestCase {
+
+	public function test_uri_method_returns_path_info_if_set()
+	{
+		$_SERVER['PATH_INFO'] = 'something';
+		$this->assertEquals('something', Laravel\Request::uri());
+	}
+
+}