ソースを参照

Backport of 3.x

Mark Scherer 11 年 前
コミット
e5a93bd62d
1 ファイル変更6 行追加2 行削除
  1. 6 2
      TestSuite/IntegrationTestCase.php

+ 6 - 2
TestSuite/IntegrationTestCase.php

@@ -261,16 +261,20 @@ abstract class IntegrationTestCase extends MyControllerTestCase {
 /**
 /**
  * Assert that the Location header is correct.
  * Assert that the Location header is correct.
  *
  *
- * @param string|array $url The url you expected the client to go to. This
+ * @param string|array|null $url The URL you expected the client to go to. This
  *   can either be a string URL or an array compatible with Router::url()
  *   can either be a string URL or an array compatible with Router::url()
  * @param string $message The failure message that will be appended to the generated message.
  * @param string $message The failure message that will be appended to the generated message.
  * @return void
  * @return void
  */
  */
-	public function assertRedirect($url, $message = '') {
+	public function assertRedirect($url = null, $message = '') {
 		if (!$this->_response) {
 		if (!$this->_response) {
 			$this->fail('No response set, cannot assert location header. ' . $message);
 			$this->fail('No response set, cannot assert location header. ' . $message);
 		}
 		}
 		$result = $this->_response->header();
 		$result = $this->_response->header();
+		if ($url === null) {
+			$this->assertTrue(!empty($result['Location']), $message);
+			return;
+		}
 		if (empty($result['Location'])) {
 		if (empty($result['Location'])) {
 			$this->fail('No location header set. ' . $message);
 			$this->fail('No location header set. ' . $message);
 		}
 		}