Browse Source

Merge pull request #5412 from cakephp/3.0-integrationtestcase

Allow testing of a specific status code.
Mark Story 11 years ago
parent
commit
3a43fff0d6
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/TestSuite/IntegrationTestCase.php

+ 11 - 0
src/TestSuite/IntegrationTestCase.php

@@ -372,6 +372,17 @@ abstract class IntegrationTestCase extends TestCase {
 	}
 
 /**
+ * Asserts a specific response status code.
+ *
+ * @param int $code Status code to assert.
+ * @return void
+ */
+	public function assertResponseCode($code) {
+		$actual = $this->_response->statusCode();
+		$this->_assertStatus($code, $code, 'Status code is not ' . $code . ' but ' . $actual);
+	}
+
+/**
  * Helper method for status assertions.
  *
  * @param int $min Min status code.