Commit fcbd132c authored by Igor Wiedler's avatar Igor Wiedler

remove dummy domain from Request::create() calls in tests

parent 3641d78b
......@@ -43,7 +43,7 @@ class BeforeAfterFilterTest extends \PHPUnit_Framework_TestCase
$i++;
});
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$framework->handle($request);
$test->assertEquals(3, $i);
......
......@@ -32,7 +32,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
));
try {
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$framework->handle($request);
$this->fail('->handle() should not catch exceptions where no error handler was supplied');
} catch (\RuntimeException $e) {
......@@ -52,7 +52,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
return new Response('foo exception handler');
});
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$this->checkRouteResponse($framework, '/foo', 'foo exception handler');
}
......@@ -80,7 +80,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
return new Response('foo exception handler 2');
});
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$this->checkRouteResponse($framework, '/foo', 'foo exception handler', 'should return the first response returned by an exception handler');
$this->assertEquals(3, $errors, 'should execute all error handlers');
......@@ -101,7 +101,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
});
try {
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$framework->handle($request);
$this->fail('->handle() should not catch exceptions where an empty error handler was supplied');
} catch (\RuntimeException $e) {
......@@ -123,7 +123,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
return 'foo exception handler';
});
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$this->checkRouteResponse($framework, '/foo', 'foo exception handler', 'should accept a string response from the error handler');
}
......@@ -140,7 +140,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
});
try {
$request = Request::create('http://test.com/foo');
$request = Request::create('/foo');
$this->checkRouteResponse($framework, '/foo', 'foo exception handler', 'should accept a string response from the error handler');
$this->fail('->handle() should not catch exceptions thrown from an error handler');
} catch (\RuntimeException $e) {
......@@ -150,7 +150,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
protected function checkRouteResponse($framework, $path, $expectedContent, $method = 'get', $message = null)
{
$request = Request::create('http://test.com' . $path, $method);
$request = Request::create($path, $method);
$response = $framework->handle($request);
$this->assertEquals($expectedContent, $response->getContent(), $message);
}
......
......@@ -71,7 +71,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$this->checkRouteResponse($framework, '/', 'root', 'delete');
try {
$request = Request::create('http://test.com/bar');
$request = Request::create('/bar');
$framework->handle($request);
$this->fail('Framework must reject HTTP GET method to /bar');
......@@ -79,7 +79,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
}
try {
$request = Request::create('http://test.com/bar', 'post');
$request = Request::create('/bar', 'post');
$framework->handle($request);
$this->fail('Framework must reject HTTP POST method to /bar');
......@@ -130,15 +130,15 @@ class RouterTest extends \PHPUnit_Framework_TestCase
},
));
$request = Request::create('http://test.com/created', 'put');
$request = Request::create('/created', 'put');
$response = $framework->handle($request);
$this->assertEquals(201, $response->getStatusCode());
$request = Request::create('http://test.com/forbidden');
$request = Request::create('/forbidden');
$response = $framework->handle($request);
$this->assertEquals(403, $response->getStatusCode());
$request = Request::create('http://test.com/not_found');
$request = Request::create('/not_found');
$response = $framework->handle($request);
$this->assertEquals(404, $response->getStatusCode());
}
......@@ -153,7 +153,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
},
));
$request = Request::create('http://test.com/redirect');
$request = Request::create('/redirect');
$response = $framework->handle($request);
$this->assertTrue($response->isRedirected('/target'));
}
......@@ -165,7 +165,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
{
$framework = new Framework();
$request = Request::create('http://test.com/baz');
$request = Request::create('/baz');
$framework->handle($request);
}
......@@ -202,7 +202,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
protected function checkRouteResponse($framework, $path, $expectedContent, $method = 'get', $message = null)
{
$request = Request::create('http://test.com' . $path, $method);
$request = Request::create($path, $method);
$response = $framework->handle($request);
$this->assertEquals($expectedContent, $response->getContent(), $message);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment