diff options
author | Dhruv <dhruv.goel92@gmail.com> | 2014-06-14 14:27:57 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2014-06-23 01:26:14 +0530 |
commit | 648cbbd9a0f5c01795d36293f43274a7a33d391e (patch) | |
tree | 70a918616e8b323e962a9e0f43c062608fda29c4 /tests/test_framework/phpbb_functional_test_case.php | |
parent | 01f350a61466f365eaa5d3bf9c4a69335d09d9df (diff) | |
download | forums-648cbbd9a0f5c01795d36293f43274a7a33d391e.tar forums-648cbbd9a0f5c01795d36293f43274a7a33d391e.tar.gz forums-648cbbd9a0f5c01795d36293f43274a7a33d391e.tar.bz2 forums-648cbbd9a0f5c01795d36293f43274a7a33d391e.tar.xz forums-648cbbd9a0f5c01795d36293f43274a7a33d391e.zip |
[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
Diffstat (limited to 'tests/test_framework/phpbb_functional_test_case.php')
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 27 |
1 files changed, 20 insertions, 7 deletions
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(); } /** |