Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions tests/system/HTTP/URITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,56 +863,56 @@ public function testSetBadSegmentSilent()

public function testBasedNoIndex()
{
$this->resetServices();

$_SERVER['HTTP_HOST'] = 'example.com';
$_SERVER['REQUEST_URI'] = '/ci/v4/controller/method';

$this->resetServices();

$config = new App();
$config->baseURL = 'http://example.com/ci/v4';
$config->indexPage = 'index.php';
$request = Services::request($config);
$request->uri = new URI('http://example.com/ci/v4/controller/method');
$config->baseURL = 'http://example.com/ci/v4/';
$config->indexPage = '';
Factories::injectMock('config', 'App', $config);

$request = Services::request($config);
Services::injectMock('request', $request);

// going through request
$this->assertSame('http://example.com/ci/v4/controller/method', (string) $request->getUri());
$this->assertSame('/ci/v4/controller/method', $request->getUri()->getPath());
Comment thread
MGatner marked this conversation as resolved.
$this->assertSame('ci/v4/controller/method', $request->getUri()->getPath());

// standalone
$uri = new URI('http://example.com/ci/v4/controller/method');
$this->assertSame('http://example.com/ci/v4/controller/method', (string) $uri);
$this->assertSame('/ci/v4/controller/method', $uri->getPath());

$this->assertSame($uri->getPath(), $request->getUri()->getPath());
$this->assertSame($uri->getPath(), '/' . $request->getUri()->getPath());
}

public function testBasedWithIndex()
{
$this->resetServices();

$_SERVER['HTTP_HOST'] = 'example.com';
$_SERVER['REQUEST_URI'] = '/ci/v4/index.php/controller/method';

$this->resetServices();

$config = new App();
$config->baseURL = 'http://example.com/ci/v4';
$config->baseURL = 'http://example.com/ci/v4/';
$config->indexPage = 'index.php';
$request = Services::request($config);
$request->uri = new URI('http://example.com/ci/v4/index.php/controller/method');
Factories::injectMock('config', 'App', $config);

$request = Services::request($config);
Services::injectMock('request', $request);

// going through request
$this->assertSame('http://example.com/ci/v4/index.php/controller/method', (string) $request->getUri());
$this->assertSame('/ci/v4/index.php/controller/method', $request->getUri()->getPath());
$this->assertSame('ci/v4/index.php/controller/method', $request->getUri()->getPath());

// standalone
$uri = new URI('http://example.com/ci/v4/index.php/controller/method');
$this->assertSame('http://example.com/ci/v4/index.php/controller/method', (string) $uri);
$this->assertSame('/ci/v4/index.php/controller/method', $uri->getPath());

$this->assertSame($uri->getPath(), $request->getUri()->getPath());
$this->assertSame($uri->getPath(), '/' . $request->getUri()->getPath());
}

public function testForceGlobalSecureRequests()
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Pager/PagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ public function testBasedURI()
$config = new App();
$config->baseURL = 'http://example.com/ci/v4/';
$config->indexPage = 'fc.php';
$request = Services::request($config);
$request->uri = new URI('http://example.com/ci/v4/x/y');
Factories::injectMock('config', 'App', $config);

$request = Services::request($config);
Services::injectMock('request', $request);

$this->config = new PagerConfig();
Expand Down