Skip to content

Commit

Permalink
[9.x] Add test for AssertSessionHasNoErrors() method (#41722)
Browse files Browse the repository at this point in the history
  • Loading branch information
reziamini authored Mar 28, 2022
1 parent 6b4d447 commit dc81d74
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/Testing/TestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,25 @@ public function testAssertSessionDoesntHaveErrors()
$response->assertSessionDoesntHaveErrors(['foo']);
}

public function testAssertSessionHasNoErrors()
{
$this->expectException(AssertionFailedError::class);

app()->instance('session.store', $store = new Store('test-session', new ArraySessionHandler(1)));

$store->put('errors', $errorBag = new ViewErrorBag);

$errorBag->put('default', new MessageBag([
'foo' => [
'foo is required',
],
]));

$response = TestResponse::fromBaseResponse(new Response());

$response->assertSessionHasNoErrors();
}

public function testAssertSessionHas()
{
app()->instance('session.store', $store = new Store('test-session', new ArraySessionHandler(1)));
Expand Down

0 comments on commit dc81d74

Please sign in to comment.