Skip to content

Commit

Permalink
Add tests for Uri object being correct.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 13, 2016
1 parent 81fc2f8 commit 1dae2c1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/TestCase/Network/RequestTest.php
Expand Up @@ -2198,9 +2198,17 @@ public function testEnvironmentDetection($name, $env, $expected)
$this->_loadEnvironment($env);

$request = Request::createFromGlobals();
$this->assertEquals($expected['url'], $request->url, "url error");
$this->assertEquals($expected['base'], $request->base, "base error");
$uri = $request->getUri();

$this->assertEquals($expected['url'], $request->url, "URL is incorrect");
$this->assertEquals('/' . $expected['url'], $uri->getPath(), 'Uri->getPath() is incorrect');

$this->assertEquals($expected['base'], $request->base, "base is incorrect");
$this->assertEquals($expected['base'], $request->getAttribute('base'), "base is incorrect");

$this->assertEquals($expected['webroot'], $request->webroot, "webroot error");
$this->assertEquals($expected['webroot'], $request->getAttribute('webroot'), "webroot is incorrect");

if (isset($expected['urlParams'])) {
$this->assertEquals($expected['urlParams'], $request->query, "GET param mismatch");
}
Expand Down

0 comments on commit 1dae2c1

Please sign in to comment.