From ffae59a4862e39f2011dc0d7ea934bdf30f694e7 Mon Sep 17 00:00:00 2001 From: Rod Elias Date: Sat, 9 Jun 2018 16:16:55 -0300 Subject: [PATCH] add assertOk() response assertion --- .../Foundation/Testing/TestResponse.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index 633c9b45b414..f830cb9ec408 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -64,6 +64,21 @@ public function assertSuccessful() return $this; } + /** + * Assert that the response has an OK status code. + * + * @return $this + */ + public function assertOk() + { + PHPUnit::assertTrue( + $this->isOk(), + 'Response status code [' . $this->getStatusCode() . '] is not an OK status code.' + ); + + return $this; + } + /** * Assert that the response has a not found status code. *