|
30 | 30 | use Config\Logger;
|
31 | 31 | use Config\Modules;
|
32 | 32 | use Kint;
|
| 33 | +use RuntimeException; |
33 | 34 | use stdClass;
|
34 | 35 | use Tests\Support\Models\JobModel;
|
35 | 36 |
|
@@ -390,9 +391,28 @@ public function testReallyWritable()
|
390 | 391 |
|
391 | 392 | public function testSlashItem()
|
392 | 393 | {
|
393 |
| - $this->assertSame('/', slash_item('cookiePath')); // slash already there |
394 |
| - $this->assertNull(null, slash_item('cookieDomain')); // empty, so untouched |
395 |
| - $this->assertSame('en/', slash_item('defaultLocale')); // slash appended |
| 394 | + $this->assertSame('/', slash_item('cookiePath')); // / |
| 395 | + $this->assertSame('', slash_item('cookieDomain')); // '' |
| 396 | + $this->assertSame('en/', slash_item('defaultLocale')); // en |
| 397 | + $this->assertSame('7200/', slash_item('sessionExpiration')); // int 7200 |
| 398 | + $this->assertSame('', slash_item('negotiateLocale')); // false |
| 399 | + $this->assertSame('1/', slash_item('cookieHTTPOnly')); // true |
| 400 | + } |
| 401 | + |
| 402 | + public function testSlashItemOnInexistentItem() |
| 403 | + { |
| 404 | + $this->assertNull(slash_item('foo')); |
| 405 | + $this->assertNull(slash_item('bar')); |
| 406 | + $this->assertNull(slash_item('cookieDomains')); |
| 407 | + $this->assertNull(slash_item('indices')); |
| 408 | + } |
| 409 | + |
| 410 | + public function testSlashItemThrowsErrorOnNonStringableItem() |
| 411 | + { |
| 412 | + $this->expectException(RuntimeException::class); |
| 413 | + $this->expectExceptionMessage('Cannot convert "Config\\App::$supportedLocales" of type "array" to type "string".'); |
| 414 | + |
| 415 | + slash_item('supportedLocales'); |
396 | 416 | }
|
397 | 417 |
|
398 | 418 | protected function injectSessionMock()
|
|
0 commit comments