Skip to content

Commit

Permalink
Merge pull request #28837 from sebdesign/5.8
Browse files Browse the repository at this point in the history
[5.8] Assert that the session contains a given piece of data using a closure
  • Loading branch information
taylorotwell authored Jun 14, 2019
2 parents 02d2422 + 730488e commit 1fb67cc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,8 @@ public function assertSessionHas($key, $value = null)
$this->session()->has($key),
"Session is missing expected key [{$key}]."
);
} elseif ($value instanceof Closure) {
PHPUnit::assertTrue($value($this->session()->get($key)));
} else {
PHPUnit::assertEquals($value, $this->session()->get($key));
}
Expand Down

0 comments on commit 1fb67cc

Please sign in to comment.