From 648cbbd9a0f5c01795d36293f43274a7a33d391e Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 14:27:57 +0530 Subject: [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 --- .../test_framework/phpbb_functional_test_case.php | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'tests/test_framework/phpbb_functional_test_case.php') diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 746dd34f70..6ce5d92ee1 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -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(); } /** -- cgit v1.2.1