mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge pull request #3269 from michalsn/uri_tests
Add more URI class tests to fully illustrate current behavior
This commit is contained in:
commit
831abd6652
@ -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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user