1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-21 16:22:22 +02:00

Merge pull request #4152 from marc1706/ticket/14442

[ticket/14442] Use Goutte 2.0 for functional tests

* marc1706/ticket/14442:
  [ticket/14442] Use get_content() in functional test case
  [ticket/14442] Properly set plupload header
  [ticket/14442] Use get_content() in plupload functional tests
  [ticket/14442] Use Goutte 2.0 instead of outdated 1.0
This commit is contained in:
Tristan Darricau 2016-02-02 13:01:25 +01:00
commit 15e9367b5b
4 changed files with 228 additions and 35 deletions

View File

@ -47,8 +47,7 @@
"twig/twig": "1.*"
},
"require-dev": {
"fabpot/goutte": "1.0.*",
"guzzle/guzzle": "3.9.*",
"fabpot/goutte": "~2.0",
"phing/phing": "2.4.*",
"phpunit/dbunit": "1.3.*",
"phpunit/phpunit": "4.1.*",

238
phpBB/composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "b7cd29af73c4846ea28c2c9fbee1067b",
"content-hash": "321f60039c3712a7e8b351aee8f9aca1",
"hash": "f76b5185058599cad6a87ef7c8c35fbf",
"content-hash": "b89d3c18f8d9b3c4dc476f92030a83a1",
"packages": [
{
"name": "bantu/ini-get-wrapper",
@ -1356,41 +1356,34 @@
"packages-dev": [
{
"name": "fabpot/goutte",
"version": "v1.0.7",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/Goutte.git",
"reference": "794b196e76bdd37b5155cdecbad311f0a3b07625"
"reference": "0ad3ee6dc2d0aaa832a80041a1e09bf394e99802"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/794b196e76bdd37b5155cdecbad311f0a3b07625",
"reference": "794b196e76bdd37b5155cdecbad311f0a3b07625",
"url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/0ad3ee6dc2d0aaa832a80041a1e09bf394e99802",
"reference": "0ad3ee6dc2d0aaa832a80041a1e09bf394e99802",
"shasum": ""
},
"require": {
"ext-curl": "*",
"guzzle/http": "~3.1",
"php": ">=5.3.0",
"guzzlehttp/guzzle": ">=4,<6",
"php": ">=5.4.0",
"symfony/browser-kit": "~2.1",
"symfony/css-selector": "~2.1",
"symfony/dom-crawler": "~2.1",
"symfony/finder": "~2.1",
"symfony/process": "~2.1"
},
"require-dev": {
"guzzle/plugin-history": "~3.1",
"guzzle/plugin-mock": "~3.1"
"symfony/dom-crawler": "~2.1"
},
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-0": {
"Goutte": "."
"psr-4": {
"Goutte\\": "Goutte"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -1404,11 +1397,11 @@
}
],
"description": "A simple PHP Web Scraper",
"homepage": "https://github.com/fabpot/Goutte",
"homepage": "https://github.com/FriendsOfPHP/Goutte",
"keywords": [
"scraper"
],
"time": "2014-10-09 15:52:51"
"time": "2015-05-05 21:14:57"
},
{
"name": "guzzle/guzzle",
@ -1505,6 +1498,165 @@
],
"time": "2015-03-18 18:23:50"
},
{
"name": "guzzlehttp/guzzle",
"version": "5.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "f3c8c22471cb55475105c14769644a49c3262b93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f3c8c22471cb55475105c14769644a49c3262b93",
"reference": "f3c8c22471cb55475105c14769644a49c3262b93",
"shasum": ""
},
"require": {
"guzzlehttp/ringphp": "^1.1",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2015-05-20 03:47:55"
},
{
"name": "guzzlehttp/ringphp",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"shasum": ""
},
"require": {
"guzzlehttp/streams": "~3.0",
"php": ">=5.4.0",
"react/promise": "~2.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Ring\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
"time": "2015-05-20 03:37:09"
},
{
"name": "guzzlehttp/streams",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/streams.git",
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Stream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple abstraction over streams of data",
"homepage": "http://guzzlephp.org/",
"keywords": [
"Guzzle",
"stream"
],
"time": "2014-10-12 19:18:40"
},
{
"name": "michelf/php-markdown",
"version": "1.6.0",
@ -2129,6 +2281,50 @@
],
"time": "2013-03-08 08:21:40"
},
{
"name": "react/promise",
"version": "v2.2.1",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "3b6fca09c7d56321057fa8867c8dbe1abf648627"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/3b6fca09c7d56321057fa8867c8dbe1abf648627",
"reference": "3b6fca09c7d56321057fa8867c8dbe1abf648627",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"React\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"time": "2015-07-03 13:48:55"
},
{
"name": "sami/sami",
"version": "v1.4.1",

View File

@ -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']);
}
}

View File

@ -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.');