diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/plupload_test.php | 12 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 10 |
2 files changed, 10 insertions, 12 deletions
diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index d358681ad1..9d284a7e57 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -107,11 +107,11 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case if ($i < self::CHUNKS - 1) { - $this->assertContains('{"jsonrpc":"2.0","id":"id","result":null}', self::$client->getResponse()->getContent()); + $this->assertContains('{"jsonrpc":"2.0","id":"id","result":null}', self::get_content()); } else { - $response = json_decode(self::$client->getResponse()->getContent(), true); + $response = json_decode(self::get_content(), true); $this->assertEquals('valid.jpg', $response['data'][0]['real_filename']); } @@ -134,7 +134,8 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case 'error' => UPLOAD_ERR_OK, ); - $crawler = self::$client->request( + self::$client->setServerParameter('HTTP_X_PHPBB_USING_PLUPLOAD', '1'); + self::$client->request( 'POST', $url . '&sid=' . $this->sid, array( @@ -144,11 +145,10 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case 'real_filename' => 'valid.jpg', 'add_file' => $this->lang('ADD_FILE'), ), - array('fileupload' => $file), - array('X-PHPBB-USING-PLUPLOAD' => '1') + array('fileupload' => $file) ); - $response = json_decode(self::$client->getResponse()->getContent(), true); + $response = json_decode(self::get_content(), true); $this->assertEquals('valid.jpg', $response['data'][0]['real_filename']); } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index a3864d3041..34fbcec0e2 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -16,6 +16,7 @@ require_once __DIR__ . '/mock/phpbb_mock_null_installer_task.php'; class phpbb_functional_test_case extends phpbb_test_case { + /** @var \Goutte\Client */ static protected $client; static protected $cookieJar; static protected $root_url; @@ -81,9 +82,6 @@ class phpbb_functional_test_case extends phpbb_test_case self::$cookieJar = new CookieJar; self::$client = new Goutte\Client(array(), null, self::$cookieJar); - // Reset the curl handle because it is 0 at this point and not a valid - // resource - self::$client->getClient()->getCurlMulti()->reset(true); // Clear the language array so that things // that were added in other tests are gone @@ -169,7 +167,7 @@ class phpbb_functional_test_case extends phpbb_test_case */ static public function get_content() { - return self::$client->getResponse()->getContent(); + return (string) self::$client->getResponse()->getContent(); } // bootstrap, called after board is set up @@ -843,7 +841,7 @@ class phpbb_functional_test_case extends phpbb_test_case static public function assert_response_html($status_code = 200) { // Any output before the doc type means there was an error - $content = self::$client->getResponse()->getContent(); + $content = self::get_content(); self::assertNotContains('[phpBB Debug]', $content); self::assertStringStartsWith('<!DOCTYPE', trim($content), 'Output found before DOCTYPE specification.'); @@ -864,7 +862,7 @@ class phpbb_functional_test_case extends phpbb_test_case static public function assert_response_xml($status_code = 200) { // Any output before the xml opening means there was an error - $content = self::$client->getResponse()->getContent(); + $content = self::get_content(); self::assertNotContains('[phpBB Debug]', $content); self::assertStringStartsWith('<?xml', trim($content), 'Output found before XML specification.'); |