Skip to content

Commit

Permalink
Add assert method for unauthorized response. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramytamer authored Jun 15, 2019
1 parent 1fb67cc commit b0939f5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,23 @@ public function assertForbidden()

return $this;
}

/**
* Assert that the response has an unauthorized status code.
*
* @return $this
*/
public function assertUnauthorized()
{
$actual = $this->getStatusCode();

PHPUnit::assertTrue(
401 === $actual,
'Response status code ['.$actual.'] is not an unauthorized status code.'
);

return $this;
}

/**
* Assert that the response has the given status code.
Expand Down

0 comments on commit b0939f5

Please sign in to comment.