|
12 | 12 | namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
| 15 | +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; |
15 | 16 | use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
|
16 | 17 | use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
17 | 18 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
|
|
32 | 33 | */
|
33 | 34 | class NativeSessionStorageTest extends TestCase
|
34 | 35 | {
|
| 36 | + use ExpectDeprecationTrait; |
| 37 | + |
35 | 38 | private string $savePath;
|
36 | 39 |
|
37 | 40 | private $initialSessionSaveHandler;
|
@@ -215,10 +218,14 @@ public function testCacheExpireOption()
|
215 | 218 | }
|
216 | 219 |
|
217 | 220 | /**
|
| 221 | + * @group legacy |
| 222 | + * |
218 | 223 | * The test must only be removed when the "session.trans_sid_tags" option is removed from PHP or when the "trans_sid_tags" option is no longer supported by the native session storage.
|
219 | 224 | */
|
220 | 225 | public function testTransSidTagsOption()
|
221 | 226 | {
|
| 227 | + $this->expectDeprecation('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_tags" option is deprecated and will be ignored in Symfony 8.0.'); |
| 228 | + |
222 | 229 | $previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler) {
|
223 | 230 | if ('ini_set(): Usage of session.trans_sid_tags INI setting is deprecated' !== $errstr) {
|
224 | 231 | return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false;
|
@@ -357,4 +364,24 @@ public function testSaveHandlesNullSessionGracefully()
|
357 | 364 |
|
358 | 365 | $this->addToAssertionCount(1);
|
359 | 366 | }
|
| 367 | + |
| 368 | + /** |
| 369 | + * @group legacy |
| 370 | + */ |
| 371 | + public function testPassingDeprecatedOptions() |
| 372 | + { |
| 373 | + $this->expectDeprecation('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "referer_check" option is deprecated and will be ignored in Symfony 8.0.'); |
| 374 | + $this->expectDeprecation('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "use_only_cookies" option is deprecated and will be ignored in Symfony 8.0.'); |
| 375 | + $this->expectDeprecation('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "use_trans_sid" option is deprecated and will be ignored in Symfony 8.0.'); |
| 376 | + $this->expectDeprecation('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_hosts" option is deprecated and will be ignored in Symfony 8.0.'); |
| 377 | + $this->expectDeprecation('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_tags" option is deprecated and will be ignored in Symfony 8.0.'); |
| 378 | + |
| 379 | + $this->getStorage([ |
| 380 | + 'referer_check' => 'foo', |
| 381 | + 'use_only_cookies' => 'foo', |
| 382 | + 'use_trans_sid' => 'foo', |
| 383 | + 'trans_sid_hosts' => 'foo', |
| 384 | + 'trans_sid_tags' => 'foo', |
| 385 | + ]); |
| 386 | + } |
360 | 387 | }
|
0 commit comments