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