Add more URI class tests to fully illustrate current behavior

This commit is contained in:
michalsn 2020-07-11 11:43:33 +02:00
parent f5d899c906
commit 043eb17572
No known key found for this signature in database
GPG Key ID: 0E4DB53924E59366

View File

@ -49,6 +49,7 @@ class URITest extends \CodeIgniter\Test\CIUnitTestCase
$this->assertEquals('path', $uri->getSegment(1));
$this->assertEquals('to', $uri->getSegment(2));
$this->assertEquals('script', $uri->getSegment(3));
$this->assertEquals('', $uri->getSegment(4));
$this->assertEquals(3, $uri->getTotalSegments());
}
@ -58,9 +59,8 @@ class URITest extends \CodeIgniter\Test\CIUnitTestCase
public function testSegmentOutOfRange()
{
$this->expectException(HTTPException::class);
$url = 'http://abc.com/a123/b/c';
$uri = new URI($url);
$uri->getSegment(22);
$uri = new URI('http://hostname/path/to/script');
$uri->getSegment(5);
}
//--------------------------------------------------------------------