Skip to content

Commit ab6da61

Browse files
committed
test: add assertions
1 parent 08bbc18 commit ab6da61

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎tests/system/HTTP/SiteURITest.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function testConstructor()
3434

3535
$this->assertInstanceOf(SiteURI::class, $uri);
3636
$this->assertSame('http://example.com/index.php/', (string) $uri);
37+
$this->assertSame('/', $uri->getRoutePath());
3738
$this->assertSame('/index.php/', $uri->getPath());
3839
$this->assertSame('http://example.com/', $uri->getBaseURL());
3940
}
@@ -45,6 +46,7 @@ public function testConstructorRelativePath()
4546
$uri = new SiteURI($config, 'one/two');
4647

4748
$this->assertSame('http://example.com/index.php/one/two', (string) $uri);
49+
$this->assertSame('one/two', $uri->getRoutePath());
4850
$this->assertSame('/index.php/one/two', $uri->getPath());
4951
}
5052

@@ -55,6 +57,7 @@ public function testConstructorRelativePathWithQuery()
5557
$uri = new SiteURI($config, 'one/two?foo=1&bar=2');
5658

5759
$this->assertSame('http://example.com/index.php/one/two?foo=1&bar=2', (string) $uri);
60+
$this->assertSame('one/two', $uri->getRoutePath());
5861
$this->assertSame('/index.php/one/two', $uri->getPath());
5962
$this->assertSame('foo=1&bar=2', $uri->getQuery());
6063
}
@@ -66,6 +69,7 @@ public function testConstructorRelativePathWithFragment()
6669
$uri = new SiteURI($config, 'one/two#sec1');
6770

6871
$this->assertSame('http://example.com/index.php/one/two#sec1', (string) $uri);
72+
$this->assertSame('one/two', $uri->getRoutePath());
6973
$this->assertSame('/index.php/one/two', $uri->getPath());
7074
$this->assertSame('', $uri->getQuery());
7175
$this->assertSame('sec1', $uri->getFragment());
@@ -78,6 +82,7 @@ public function testConstructorRelativePathWithQueryAndFragment()
7882
$uri = new SiteURI($config, 'one/two?foo=1&bar=2#sec1');
7983

8084
$this->assertSame('http://example.com/index.php/one/two?foo=1&bar=2#sec1', (string) $uri);
85+
$this->assertSame('one/two', $uri->getRoutePath());
8186
$this->assertSame('/index.php/one/two', $uri->getPath());
8287
$this->assertSame('foo=1&bar=2', $uri->getQuery());
8388
$this->assertSame('sec1', $uri->getFragment());
@@ -92,6 +97,7 @@ public function testConstructorHost()
9297

9398
$this->assertInstanceOf(SiteURI::class, $uri);
9499
$this->assertSame('http://sub.example.com/index.php/', (string) $uri);
100+
$this->assertSame('/', $uri->getRoutePath());
95101
$this->assertSame('/index.php/', $uri->getPath());
96102
$this->assertSame('http://sub.example.com/', $uri->getBaseURL());
97103
}
@@ -116,6 +122,7 @@ public function testConstructorSubfolder()
116122

117123
$this->assertInstanceOf(SiteURI::class, $uri);
118124
$this->assertSame('http://example.com/ci4/index.php/', (string) $uri);
125+
$this->assertSame('/', $uri->getRoutePath());
119126
$this->assertSame('/ci4/index.php/', $uri->getPath());
120127
$this->assertSame('http://example.com/ci4/', $uri->getBaseURL());
121128
}
@@ -128,6 +135,7 @@ public function testConstructorSubfolderRelativePathWithQuery()
128135
$uri = new SiteURI($config, 'one/two?foo=1&bar=2');
129136

130137
$this->assertSame('http://example.com/ci4/index.php/one/two?foo=1&bar=2', (string) $uri);
138+
$this->assertSame('one/two', $uri->getRoutePath());
131139
$this->assertSame('/ci4/index.php/one/two', $uri->getPath());
132140
$this->assertSame('foo=1&bar=2', $uri->getQuery());
133141
}
@@ -152,6 +160,8 @@ public function testConstructorIndexPageEmpty()
152160

153161
$this->assertSame('http://example.com/', (string) $uri);
154162
$this->assertSame('http://example.com/', $uri->getBaseURL());
163+
$this->assertSame('/', $uri->getRoutePath());
164+
$this->assertSame('/', $uri->getPath());
155165
}
156166

157167
public function testConstructorInvalidBaseURL()

0 commit comments

Comments
 (0)