Files
php-flasher/demo/laravel/tests/Feature/FlasherSessionTest.php
T
Younes ENNAJI d427132437 Upgrade Laravel demo to Laravel 13 for JSON session testing
- Update PHP requirement to ^8.3
- Upgrade laravel/framework to ^13.0 and laravel/tinker to ^3.0
- Upgrade pestphp/pest to ^4.0 and pest-plugin-laravel to ^4.0
- Update spatie/laravel-csp to ^3.23 and barryvdh/laravel-debugbar to ^4.1
- Add session serialization config option (defaults to 'json')
- Add FlasherSessionTest to verify flasher works with JSON sessions
2026-03-28 02:05:14 +01:00

42 lines
1.1 KiB
PHP

<?php
it('stores and retrieves flash notifications with json serialization', function () {
// Trigger a flash notification
$this->get('/');
flash()->success('Test notification', ['title' => 'Success']);
// Make another request to retrieve from session
$response = $this->get('/');
$response->assertStatus(200);
});
it('handles multiple flash notifications across requests', function () {
flash()->success('First message');
flash()->error('Second message');
flash()->warning('Third message');
$response = $this->get('/');
$response->assertStatus(200);
});
it('preserves notification properties through json session roundtrip', function () {
flash()
->options(['position' => 'top-right', 'timeout' => 5000])
->success('Test message');
$response = $this->get('/');
$response->assertStatus(200);
});
it('works with different notification types', function () {
flash()->success('Success message');
flash()->error('Error message');
flash()->warning('Warning message');
flash()->info('Info message');
$response = $this->get('/');
$response->assertStatus(200);
});