Permalink
Browse files

formatting. add new method

  • Loading branch information...
taylorotwell committed Oct 8, 2018
1 parent 5e7832c commit 3005706abb411d1468adbff6627ff26351afe446
Showing with 21 additions and 4 deletions.
  1. +21 −4 src/Illuminate/Foundation/Testing/TestResponse.php
@@ -883,13 +883,14 @@ public function assertSessionHasErrors($keys = [], $format = null, $errorBag = '
}
/**
* Assert that the session has no errors.
* Assert that the session is missing the given errors.
*
* @param string|array $keys
* @param string $format
* @param string $errorBag
* @return $this
*/
public function assertSessionHasNoErrors($keys = [], $errorBag = 'default')
public function assertSessionDoesntHaveErrors($keys = [], $format = null, $errorBag = 'default')
{
$keys = (array) $keys;
@@ -899,13 +900,29 @@ public function assertSessionHasNoErrors($keys = [], $errorBag = 'default')
$errors = $this->session()->get('errors')->getBag($errorBag);
foreach ($keys as $key) {
PHPUnit::assertFalse($errors->has($key), "Session has an unexpected error: $key");
foreach ($keys as $key => $value) {
if (is_int($key)) {
PHPUnit::assertFalse($errors->has($value), "Session has unexpected error: $value");
} else {
PHPUnit::assertNotContains($value, $errors->get($key, $format));
}
}
return $this;
}
/**
* Assert that the session has no errors.
*
* @return $this
*/
public function assertSessionHasNoErrors()
{
return $this->assertSessionMissing('errors');
return $this;
}
/**
* Assert that the session has the given errors.
*

0 comments on commit 3005706

Please sign in to comment.