1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/11528] Instantiate $client, $driver from functional test case

Make mink test case an abstract class, instantiate $driver, $client
from its child class i.e. functional test case.

PHPBB3-11528
This commit is contained in:
Dhruv
2014-06-14 14:27:57 +05:30
parent 01f350a614
commit 648cbbd9a0
2 changed files with 49 additions and 130 deletions

View File

@@ -14,7 +14,6 @@ use Symfony\Component\BrowserKit\CookieJar;
class phpbb_functional_test_case extends phpbb_mink_test_case
{
static protected $client;
static protected $cookieJar;
protected $cache = null;
@@ -42,6 +41,24 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
self::$config = phpbb_test_case_helpers::get_test_config();
self::$root_url = self::$config['phpbb_functional_url'];
self::$cookieJar = new CookieJar;
self::$client = new \Behat\Mink\Driver\Goutte\Client(array(), null, self::$cookieJar);
$client_options = array(
Guzzle\Http\Client::DISABLE_REDIRECTS => true,
'curl.options' => array(
CURLOPT_TIMEOUT => 120,
),
);
self::$client->setClient(new Guzzle\Http\Client('', $client_options));
// Reset the curl handle because it is 0 at this point and not a valid
// resource
self::$client->getClient()->getCurlMulti()->reset(true);
self::$driver = new \Behat\Mink\Driver\GoutteDriver(self::$client);
// Important: this is used both for installation and by
// test cases for querying the tables.
// Therefore table prefix must be set before a board is
@@ -74,12 +91,6 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
$this->bootstrap();
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
$this->lang = array();
@@ -113,6 +124,8 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
// Close the database connections again this test
$this->db->sql_close();
}
self::$cookieJar->clear();
}
/**