forked from tempestphp/tempest-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlashInViewTest.php
More file actions
36 lines (30 loc) · 1 KB
/
Copy pathFlashInViewTest.php
File metadata and controls
36 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Tests\Tempest\Integration\Http;
use PHPUnit\Framework\Attributes\Test;
use Tests\Tempest\Integration\FrameworkIntegrationTestCase;
/**
* @internal
*/
final class FlashInViewTest extends FrameworkIntegrationTestCase
{
#[Test]
public function flash_value_consumed_while_rendering_a_view_is_shown_once(): void
{
// A request flashes a value and redirects.
$this->http
->post('/flash-view')
->assertRedirect('/flash-view');
// The redirected request reads the flash value while rendering the view.
$this->http
->get('/flash-view')
->assertOk()
->assertSee('flashed-message');
// The following request no longer sees it: it was aged out at the start of
// this request, even though it was only ever read while rendering the view.
$this->http
->get('/flash-view')
->assertOk()
->assertNotSee('flashed-message');
}
}