浏览代码

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.
  *
- * @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()
  * @param string $message The failure message that will be appended to the generated message.
  * @return void
  */
-	public function assertRedirect($url, $message = '') {
+	public function assertRedirect($url = null, $message = '') {
 		if (!$this->_response) {
 			$this->fail('No response set, cannot assert location header. ' . $message);
 		}
 		$result = $this->_response->header();
+		if ($url === null) {
+			$this->assertTrue(!empty($result['Location']), $message);
+			return;
+		}
 		if (empty($result['Location'])) {
 			$this->fail('No location header set. ' . $message);
 		}