MDL-33955 filelib: accept any HTTP 1.0 in tests
authorDan Poltawski <dan@moodle.com>
Wed, 19 Jun 2013 06:42:51 +0000 (08:42 +0200)
committerDan Poltawski <dan@moodle.com>
Wed, 19 Jun 2013 06:55:35 +0000 (14:55 +0800)
This is common with proxies like squid which don't support http
pipelining.

lib/tests/filelib_test.php

index 5fbe661..191b412 100644 (file)
@@ -105,7 +105,7 @@ class filelib_testcase extends advanced_testcase {
         $this->assertInstanceOf('stdClass', $response);
         $this->assertSame('200', $response->status);
         $this->assertTrue(is_array($response->headers));
-        $this->assertSame('HTTP/1.1 200 OK', rtrim($response->response_code));
+        $this->assertRegExp('|^HTTP/1\.[01] 200 OK$|', rtrim($response->response_code));
         $this->assertSame($contents, $response->results);
         $this->assertSame('', $response->error);
 
@@ -131,7 +131,7 @@ class filelib_testcase extends advanced_testcase {
         $this->assertInstanceOf('stdClass', $response);
         $this->assertSame('404', $response->status);
         $this->assertTrue(is_array($response->headers));
-        $this->assertSame('HTTP/1.1 404 Not Found', rtrim($response->response_code));
+        $this->assertRegExp('|^HTTP/1\.[01] 404 Not Found$|', rtrim($response->response_code));
         $this->assertStringStartsWith('<!DOCTYPE', $response->results);
         $this->assertSame('', $response->error);
 
@@ -153,7 +153,7 @@ class filelib_testcase extends advanced_testcase {
         $this->assertInstanceOf('stdClass', $response);
         $this->assertSame('200', $response->status);
         $this->assertTrue(is_array($response->headers));
-        $this->assertSame('HTTP/1.1 200 OK', rtrim($response->response_code));
+        $this->assertRegExp('|^HTTP/1\.[01] 200 OK$|', rtrim($response->response_code));
         $this->assertSame('done', $response->results);
         $this->assertSame('', $response->error);