From 0ebf6011b718a04c84c40acd3b6c038be73cfe7a Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 23 Jun 2014 01:26:02 +0530 Subject: [PATCH 01/11] [ticket/11528] Add behat/mink and mink-goutte-driver as dependency PHPBB3-11528 --- phpBB/composer.json | 2 + phpBB/composer.lock | 163 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 164 insertions(+), 1 deletion(-) diff --git a/phpBB/composer.json b/phpBB/composer.json index 435d6139e4..53d2f873f1 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -15,6 +15,8 @@ "twig/twig": "1.13.*" }, "require-dev": { + "behat/mink": "1.4.*", + "behat/mink-goutte-driver": "1.0.*", "fabpot/goutte": "1.0.*", "phpunit/dbunit": "1.3.*", "phpunit/phpunit": "4.1.*", diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 2213c3789b..89973b93d4 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "be323c0a1b5baeb83934238033e079ec", + "hash": "300d29b350ca2d75b1fa169fe46470f0", "packages": [ { "name": "lusitanian/oauth", @@ -722,6 +722,167 @@ } ], "packages-dev": [ + { + "name": "behat/mink", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/Behat/Mink.git", + "reference": "0817070a6e2ec9f475fad9bfb81a962c462eb934" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Mink/zipball/0817070a6e2ec9f475fad9bfb81a962c462eb934", + "reference": "0817070a6e2ec9f475fad9bfb81a962c462eb934", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/css-selector": ">=2.0,<2.4-dev" + }, + "suggest": { + "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", + "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", + "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Web acceptance testing framework for PHP 5.3", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "testing", + "web" + ], + "time": "2013-03-02 15:53:18" + }, + { + "name": "behat/mink-browserkit-driver", + "version": "v1.0.5", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkBrowserKitDriver.git", + "reference": "f2771b5fc4dbc233859addf37a7d150852f78418" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkBrowserKitDriver/zipball/f2771b5fc4dbc233859addf37a7d150852f78418", + "reference": "f2771b5fc4dbc233859addf37a7d150852f78418", + "shasum": "" + }, + "require": { + "behat/mink": "~1.4.3", + "php": ">=5.3.1", + "symfony/browser-kit": "~2.0", + "symfony/dom-crawler": "~2.0" + }, + "require-dev": { + "silex/silex": "@dev" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Symfony2 BrowserKit driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "Mink", + "Symfony2", + "browser", + "testing" + ], + "time": "2013-04-13 12:17:15" + }, + { + "name": "behat/mink-goutte-driver", + "version": "v1.0.9", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkGoutteDriver.git", + "reference": "fa1b073b48761464feb0b05e6825da44b20118d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/fa1b073b48761464feb0b05e6825da44b20118d8", + "reference": "fa1b073b48761464feb0b05e6825da44b20118d8", + "shasum": "" + }, + "require": { + "behat/mink-browserkit-driver": ">=1.0.5,<1.2.0", + "fabpot/goutte": "~1.0.1", + "php": ">=5.3.1" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Goutte driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "goutte", + "headless", + "testing" + ], + "time": "2013-07-03 18:43:54" + }, { "name": "fabpot/goutte", "version": "v1.0.3", From 01f350a61466f365eaa5d3bf9c4a69335d09d9df Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 16:45:33 +0530 Subject: [PATCH 02/11] [ticket/11528] Refactor install_board() code into a new class PHPBB3-11528 --- tests/bootstrap.php | 1 + .../phpbb_functional_test_case.php | 150 +---------- tests/test_framework/phpbb_mink_test_case.php | 254 ++++++++++++++++++ 3 files changed, 256 insertions(+), 149 deletions(-) create mode 100644 tests/test_framework/phpbb_mink_test_case.php diff --git a/tests/bootstrap.php b/tests/bootstrap.php index bb4a703cc3..2856ba02bb 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -31,4 +31,5 @@ require_once 'test_framework/phpbb_test_case_helpers.php'; require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; +require_once 'test_framework/phpbb_mink_test_case.php'; require_once '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 fde6a6a4ff..746dd34f70 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -12,13 +12,10 @@ */ use Symfony\Component\BrowserKit\CookieJar; -require_once __DIR__ . '/../../phpBB/includes/functions_install.php'; - -class phpbb_functional_test_case extends phpbb_test_case +class phpbb_functional_test_case extends phpbb_mink_test_case { static protected $client; static protected $cookieJar; - static protected $root_url; protected $cache = null; protected $db = null; @@ -36,7 +33,6 @@ class phpbb_functional_test_case extends phpbb_test_case */ protected $lang = array(); - static protected $config = array(); static protected $already_installed = false; static public function setUpBeforeClass() @@ -256,144 +252,6 @@ class phpbb_functional_test_case extends phpbb_test_case return $extension_manager; } - static protected function install_board() - { - global $phpbb_root_path, $phpEx; - - self::recreate_database(self::$config); - - $config_file = $phpbb_root_path . "config.$phpEx"; - $config_file_dev = $phpbb_root_path . "config_dev.$phpEx"; - $config_file_test = $phpbb_root_path . "config_test.$phpEx"; - - if (file_exists($config_file)) - { - if (!file_exists($config_file_dev)) - { - rename($config_file, $config_file_dev); - } - else - { - unlink($config_file); - } - } - - self::$cookieJar = new CookieJar; - self::$client = new Goutte\Client(array(), null, self::$cookieJar); - // Set client manually so we can increase the cURL timeout - self::$client->setClient(new Guzzle\Http\Client('', array( - Guzzle\Http\Client::DISABLE_REDIRECTS => true, - 'curl.options' => array( - CURLOPT_TIMEOUT => 120, - ), - ))); - - // Reset the curl handle because it is 0 at this point and not a valid - // resource - self::$client->getClient()->getCurlMulti()->reset(true); - - $parseURL = parse_url(self::$config['phpbb_functional_url']); - - $crawler = self::request('GET', 'install/index.php?mode=install'); - self::assertContains('Welcome to Installation', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=requirements - $crawler = self::submit($form); - self::assertContains('Installation compatibility', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Database configuration', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - // Installer uses 3.0-style dbms name - 'dbms' => str_replace('phpbb\db\driver\\', '', self::$config['dbms']), - 'dbhost' => self::$config['dbhost'], - 'dbport' => self::$config['dbport'], - 'dbname' => self::$config['dbname'], - 'dbuser' => self::$config['dbuser'], - 'dbpasswd' => self::$config['dbpasswd'], - 'table_prefix' => self::$config['table_prefix'], - )); - - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Successful connection', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=administrator - $crawler = self::submit($form); - self::assertContains('Administrator configuration', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - 'default_lang' => 'en', - 'admin_name' => 'admin', - 'admin_pass1' => 'adminadmin', - 'admin_pass2' => 'adminadmin', - 'board_email' => 'nobody@example.com', - )); - - // install/index.php?mode=install&sub=administrator - $crawler = self::submit($form); - self::assertContains('Tests passed', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // We have to skip install/index.php?mode=install&sub=config_file - // because that step will create a config.php file if phpBB has the - // permission to do so. We have to create the config file on our own - // in order to get the DEBUG constants defined. - $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true); - $config_created = file_put_contents($config_file, $config_php_data) !== false; - if (!$config_created) - { - self::markTestSkipped("Could not write $config_file file."); - } - - // We also have to create a install lock that is normally created by - // the installer. The file will be removed by the final step of the - // installer. - $install_lock_file = $phpbb_root_path . 'cache/install_lock'; - $lock_created = file_put_contents($install_lock_file, '') !== false; - if (!$lock_created) - { - self::markTestSkipped("Could not create $lock_created file."); - } - @chmod($install_lock_file, 0666); - - // install/index.php?mode=install&sub=advanced - $form_data = $form->getValues(); - unset($form_data['submit']); - - $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data); - self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - 'email_enable' => true, - 'smtp_delivery' => true, - 'smtp_host' => 'nxdomain.phpbb.com', - 'smtp_auth' => 'PLAIN', - 'smtp_user' => 'nxuser', - 'smtp_pass' => 'nxpass', - 'cookie_secure' => false, - 'force_server_vars' => false, - 'server_protocol' => $parseURL['scheme'] . '://', - 'server_name' => 'localhost', - 'server_port' => isset($parseURL['port']) ? (int) $parseURL['port'] : 80, - 'script_path' => $parseURL['path'], - )); - - // install/index.php?mode=install&sub=create_table - $crawler = self::submit($form); - self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text()); - self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=final - $crawler = self::submit($form); - self::assertContains('You have successfully installed', $crawler->text()); - - copy($config_file, $config_file_test); - } - public function install_ext($extension) { $this->login(); @@ -412,12 +270,6 @@ class phpbb_functional_test_case extends phpbb_test_case $this->logout(); } - static private function recreate_database($config) - { - $db_conn_mgr = new phpbb_database_test_connection_manager($config); - $db_conn_mgr->recreate_db(); - } - /** * Creates a new style * diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php new file mode 100644 index 0000000000..301751679c --- /dev/null +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -0,0 +1,254 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +use \Behat\Mink\Session; + +require_once __DIR__ . '/../../phpBB/includes/functions_install.php'; + +class phpbb_mink_test_case extends phpbb_test_case +{ + static protected $driver; + static protected $session; + static protected $config = array(); + static protected $root_url; + + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + } + + public function setUp() + { + parent::setUp(); + } + + static protected function recreate_database($config) + { + $db_conn_mgr = new phpbb_database_test_connection_manager($config); + $db_conn_mgr->recreate_db(); + } + + static protected function visit($path) + { + if(!isset(self::$session)) + { + self::markTestSkipped('Session not initialized.'); + } + + self::$session->visit(self::$root_url . $path); + return self::$session->getPage(); + } + + static protected function click_submit() + { + self::$session->getPage()->findById('submit')->click(); + return self::$session->getPage(); + } + + static protected function install_board() + { + global $phpbb_root_path, $phpEx; + + self::recreate_database(self::$config); + + $config_file = $phpbb_root_path . "config.$phpEx"; + $config_file_dev = $phpbb_root_path . "config_dev.$phpEx"; + $config_file_test = $phpbb_root_path . "config_test.$phpEx"; + + if (file_exists($config_file)) + { + if (!file_exists($config_file_dev)) + { + rename($config_file, $config_file_dev); + } + else + { + unlink($config_file); + } + } + + + $client = new \Behat\Mink\Driver\Goutte\Client(); + + $client_options = array( + Guzzle\Http\Client::DISABLE_REDIRECTS => true, + 'curl.options' => array( + CURLOPT_TIMEOUT => 120, + ), + ); + + $client->setClient(new Guzzle\Http\Client('', $client_options)); + + // Reset the curl handle because it is 0 at this point and not a valid + // resource + $client->getClient()->getCurlMulti()->reset(true); + + self::$driver = new \Behat\Mink\Driver\GoutteDriver($client); + self::$session = new Session(self::$driver); + + $parseURL = parse_url(self::$config['phpbb_functional_url']); + + self::visit('install/index.php?mode=install'); + + // install/index.php?mode=install&sub=requirements + $page = self::click_submit(); + + // install/index.php?mode=install&sub=database + $page = self::click_submit(); + + $page->findById('dbms')->setValue(str_replace('phpbb\db\driver\\', '', self::$config['dbms'])); + $page->findById('dbhost')->setValue(self::$config['dbhost']); + $page->findById('dbport')->setValue(self::$config['dbport']); + $page->findById('dbname')->setValue(self::$config['dbname']); + $page->findById('dbuser')->setValue(self::$config['dbuser']); + $page->findById('dbpasswd')->setValue(self::$config['dbpasswd']); + $page->findById('table_prefix')->setValue(self::$config['table_prefix']); + + $page = self::click_submit(); + + $page = self::click_submit(); + + $page->findById('admin_name')->setValue('admin'); + $page->findById('admin_pass1')->setValue('adminadmin'); + $page->findById('admin_pass2')->setValue('adminadmin'); + $page->findById('board_email')->setValue('nobody@example.com'); + + $page = self::click_submit(); + + $page = self::click_submit(); + + // Installer has created a config.php file, we will overwrite it with a + // config file of our own in order to get the DEBUG constants defined + $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true); + $config_created = file_put_contents($config_file, $config_php_data) !== false; + if (!$config_created) + { + self::markTestSkipped("Could not write $config_file file."); + } + + $page = self::click_submit(); + + $page->findById('smtp_delivery')->setValue('1'); + $page->findById('smtp_host')->setValue('nxdomain.phpbb.com'); + $page->findById('smtp_user')->setValue('nxuser'); + $page->findById('smtp_pass')->setValue('nxpass'); + $page->findById('server_protocol')->setValue($parseURL['scheme'] . '://'); + $page->findById('server_name')->setValue('localhost'); + $page->findById('server_port')->setValue(isset($parseURL['port']) ? $parseURL['port'] : 80); + $page->findById('script_path')->setValue($parseURL['path']); + + $page = self::click_submit(); + + $page = self::click_submit(); + + copy($config_file, $config_file_test); + + /*$crawler = self::request('GET', 'install/index.php?mode=install'); + self::assertContains('Welcome to Installation', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(); + + // install/index.php?mode=install&sub=requirements + $crawler = self::submit($form); + self::assertContains('Installation compatibility', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(); + + // install/index.php?mode=install&sub=database + $crawler = self::submit($form); + self::assertContains('Database configuration', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(array( + // Installer uses 3.0-style dbms name + 'dbms' => str_replace('phpbb\db\driver\\', '', self::$config['dbms']), + 'dbhost' => self::$config['dbhost'], + 'dbport' => self::$config['dbport'], + 'dbname' => self::$config['dbname'], + 'dbuser' => self::$config['dbuser'], + 'dbpasswd' => self::$config['dbpasswd'], + 'table_prefix' => self::$config['table_prefix'], + )); + + // install/index.php?mode=install&sub=database + $crawler = self::submit($form); + self::assertContains('Successful connection', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(); + + // install/index.php?mode=install&sub=administrator + $crawler = self::submit($form); + self::assertContains('Administrator configuration', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(array( + 'default_lang' => 'en', + 'admin_name' => 'admin', + 'admin_pass1' => 'adminadmin', + 'admin_pass2' => 'adminadmin', + 'board_email' => 'nobody@example.com', + )); + + // install/index.php?mode=install&sub=administrator + $crawler = self::submit($form); + self::assertContains('Tests passed', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(); + + // We have to skip install/index.php?mode=install&sub=config_file + // because that step will create a config.php file if phpBB has the + // permission to do so. We have to create the config file on our own + // in order to get the DEBUG constants defined. + $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true); + $config_created = file_put_contents($config_file, $config_php_data) !== false; + if (!$config_created) + { + self::markTestSkipped("Could not write $config_file file."); + } + + // We also have to create a install lock that is normally created by + // the installer. The file will be removed by the final step of the + // installer. + $install_lock_file = $phpbb_root_path . 'cache/install_lock'; + $lock_created = file_put_contents($install_lock_file, '') !== false; + if (!$lock_created) + { + self::markTestSkipped("Could not create $lock_created file."); + } + @chmod($install_lock_file, 0666); + + // install/index.php?mode=install&sub=advanced + $form_data = $form->getValues(); + unset($form_data['submit']); + + $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data); + self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(array( + 'email_enable' => true, + 'smtp_delivery' => true, + 'smtp_host' => 'nxdomain.phpbb.com', + 'smtp_auth' => 'PLAIN', + 'smtp_user' => 'nxuser', + 'smtp_pass' => 'nxpass', + 'cookie_secure' => false, + 'force_server_vars' => false, + 'server_protocol' => $parseURL['scheme'] . '://', + 'server_name' => 'localhost', + 'server_port' => isset($parseURL['port']) ? (int) $parseURL['port'] : 80, + 'script_path' => $parseURL['path'], + )); + + // install/index.php?mode=install&sub=create_table + $crawler = self::submit($form); + self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text()); + self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text()); + $form = $crawler->selectButton('submit')->form(); + + // install/index.php?mode=install&sub=final + $crawler = self::submit($form); + self::assertContains('You have successfully installed', $crawler->text()); + + copy($config_file, $config_file_test);*/ + } +} From 648cbbd9a0f5c01795d36293f43274a7a33d391e Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 14:27:57 +0530 Subject: [PATCH 03/11] [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 --- .../phpbb_functional_test_case.php | 27 +++- tests/test_framework/phpbb_mink_test_case.php | 152 ++++-------------- 2 files changed, 49 insertions(+), 130 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(); } /** diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index 301751679c..555574e053 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -14,13 +14,23 @@ use \Behat\Mink\Session; require_once __DIR__ . '/../../phpBB/includes/functions_install.php'; -class phpbb_mink_test_case extends phpbb_test_case +abstract class phpbb_mink_test_case extends phpbb_test_case { static protected $driver; + static protected $client; static protected $session; static protected $config = array(); static protected $root_url; + public function __construct($name = NULL, array $data = array(), $dataName = '') + { + parent::__construct($name, $data, $dataName); + + $this->backupStaticAttributesBlacklist += array( + 'phpbb_mink_test_case' => array('config', 'already_installed'), + ); + } + static public function setUpBeforeClass() { parent::setUpBeforeClass(); @@ -29,6 +39,16 @@ class phpbb_mink_test_case extends phpbb_test_case public function setUp() { parent::setUp(); + + if(!self::$driver) + { + self::markTestSkipped('Mink driver not initialized.'); + } + + if(!self::$session) + { + self::$session = new Session(self::$driver); + } } static protected function recreate_database($config) @@ -37,13 +57,14 @@ class phpbb_mink_test_case extends phpbb_test_case $db_conn_mgr->recreate_db(); } + protected function tearDown() + { + parent::tearDown(); + self::$session->reset(); + } + static protected function visit($path) { - if(!isset(self::$session)) - { - self::markTestSkipped('Session not initialized.'); - } - self::$session->visit(self::$root_url . $path); return self::$session->getPage(); } @@ -59,6 +80,7 @@ class phpbb_mink_test_case extends phpbb_test_case global $phpbb_root_path, $phpEx; self::recreate_database(self::$config); + self::$session = new Session(self::$driver); $config_file = $phpbb_root_path . "config.$phpEx"; $config_file_dev = $phpbb_root_path . "config_dev.$phpEx"; @@ -76,25 +98,6 @@ class phpbb_mink_test_case extends phpbb_test_case } } - - $client = new \Behat\Mink\Driver\Goutte\Client(); - - $client_options = array( - Guzzle\Http\Client::DISABLE_REDIRECTS => true, - 'curl.options' => array( - CURLOPT_TIMEOUT => 120, - ), - ); - - $client->setClient(new Guzzle\Http\Client('', $client_options)); - - // Reset the curl handle because it is 0 at this point and not a valid - // resource - $client->getClient()->getCurlMulti()->reset(true); - - self::$driver = new \Behat\Mink\Driver\GoutteDriver($client); - self::$session = new Session(self::$driver); - $parseURL = parse_url(self::$config['phpbb_functional_url']); self::visit('install/index.php?mode=install'); @@ -152,103 +155,6 @@ class phpbb_mink_test_case extends phpbb_test_case copy($config_file, $config_file_test); - /*$crawler = self::request('GET', 'install/index.php?mode=install'); - self::assertContains('Welcome to Installation', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=requirements - $crawler = self::submit($form); - self::assertContains('Installation compatibility', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Database configuration', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - // Installer uses 3.0-style dbms name - 'dbms' => str_replace('phpbb\db\driver\\', '', self::$config['dbms']), - 'dbhost' => self::$config['dbhost'], - 'dbport' => self::$config['dbport'], - 'dbname' => self::$config['dbname'], - 'dbuser' => self::$config['dbuser'], - 'dbpasswd' => self::$config['dbpasswd'], - 'table_prefix' => self::$config['table_prefix'], - )); - - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Successful connection', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=administrator - $crawler = self::submit($form); - self::assertContains('Administrator configuration', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - 'default_lang' => 'en', - 'admin_name' => 'admin', - 'admin_pass1' => 'adminadmin', - 'admin_pass2' => 'adminadmin', - 'board_email' => 'nobody@example.com', - )); - - // install/index.php?mode=install&sub=administrator - $crawler = self::submit($form); - self::assertContains('Tests passed', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // We have to skip install/index.php?mode=install&sub=config_file - // because that step will create a config.php file if phpBB has the - // permission to do so. We have to create the config file on our own - // in order to get the DEBUG constants defined. - $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true); - $config_created = file_put_contents($config_file, $config_php_data) !== false; - if (!$config_created) - { - self::markTestSkipped("Could not write $config_file file."); - } - - // We also have to create a install lock that is normally created by - // the installer. The file will be removed by the final step of the - // installer. - $install_lock_file = $phpbb_root_path . 'cache/install_lock'; - $lock_created = file_put_contents($install_lock_file, '') !== false; - if (!$lock_created) - { - self::markTestSkipped("Could not create $lock_created file."); - } - @chmod($install_lock_file, 0666); - - // install/index.php?mode=install&sub=advanced - $form_data = $form->getValues(); - unset($form_data['submit']); - - $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data); - self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - 'email_enable' => true, - 'smtp_delivery' => true, - 'smtp_host' => 'nxdomain.phpbb.com', - 'smtp_auth' => 'PLAIN', - 'smtp_user' => 'nxuser', - 'smtp_pass' => 'nxpass', - 'cookie_secure' => false, - 'force_server_vars' => false, - 'server_protocol' => $parseURL['scheme'] . '://', - 'server_name' => 'localhost', - 'server_port' => isset($parseURL['port']) ? (int) $parseURL['port'] : 80, - 'script_path' => $parseURL['path'], - )); - - // install/index.php?mode=install&sub=create_table - $crawler = self::submit($form); - self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text()); - self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // install/index.php?mode=install&sub=final - $crawler = self::submit($form); - self::assertContains('You have successfully installed', $crawler->text()); - - copy($config_file, $config_file_test);*/ + self::$session->stop(); } } From 019b345171d271535b32b09f82ad24c16ec8b0b8 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 15:30:47 +0530 Subject: [PATCH 04/11] [ticket/11528] Call parent::tearDown in overrided tearDown method PHPBB3-11528 --- tests/functional/fileupload_form_test.php | 2 ++ tests/functional/fileupload_remote_test.php | 2 ++ tests/functional/forgot_password_test.php | 2 ++ tests/functional/plupload_test.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php index cf36a0523f..f11213be38 100644 --- a/tests/functional/fileupload_form_test.php +++ b/tests/functional/fileupload_form_test.php @@ -27,6 +27,8 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case public function tearDown() { + parent::tearDown(); + $iterator = new DirectoryIterator(__DIR__ . '/../../phpBB/files/'); foreach ($iterator as $fileinfo) { diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index f904258a5c..5d935eec59 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -40,6 +40,8 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function tearDown() { + parent::tearDown(); + global $config, $user; $user = null; $config = array(); diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php index 64fa19557f..efb5f64f87 100644 --- a/tests/functional/forgot_password_test.php +++ b/tests/functional/forgot_password_test.php @@ -47,6 +47,8 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case public function tearDown() { + parent::tearDown(); + $this->login(); $this->admin_login(); diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index ee71597ffc..d0aa8cda68 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -41,6 +41,8 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case public function tearDown() { + parent::tearDown(); + $this->set_extension_group_permission(0); $iterator = new DirectoryIterator(__DIR__ . '/../../phpBB/files/'); foreach ($iterator as $fileinfo) From c26fa6a15b716dcf43d063b41ec5d646fc115e19 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 17:46:35 +0530 Subject: [PATCH 05/11] [ticket/11528] Move parent::tearDown() to end of tearDown() PHPBB3-11528 --- tests/functional/fileupload_form_test.php | 4 ++-- tests/functional/fileupload_remote_test.php | 4 ++-- tests/functional/forgot_password_test.php | 4 ++-- tests/functional/plupload_test.php | 4 ++-- tests/test_framework/phpbb_functional_test_case.php | 3 +-- tests/test_framework/phpbb_mink_test_case.php | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php index f11213be38..b9d55fbd3c 100644 --- a/tests/functional/fileupload_form_test.php +++ b/tests/functional/fileupload_form_test.php @@ -27,8 +27,6 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case public function tearDown() { - parent::tearDown(); - $iterator = new DirectoryIterator(__DIR__ . '/../../phpBB/files/'); foreach ($iterator as $fileinfo) { @@ -44,6 +42,8 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case unlink($fileinfo->getPathname()); } + + parent::tearDown(); } private function upload_file($filename, $mimetype) diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 5d935eec59..b170fc051f 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -40,11 +40,11 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function tearDown() { - parent::tearDown(); - global $config, $user; $user = null; $config = array(); + + parent::tearDown(); } public function test_invalid_extension() diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php index efb5f64f87..c95efc5b2e 100644 --- a/tests/functional/forgot_password_test.php +++ b/tests/functional/forgot_password_test.php @@ -47,8 +47,6 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case public function tearDown() { - parent::tearDown(); - $this->login(); $this->admin_login(); @@ -59,5 +57,7 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case 'config[allow_password_reset]' => 1, )); $crawler = self::submit($form); + + parent::tearDown(); } } diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index d0aa8cda68..d9faec035c 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -41,8 +41,6 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case public function tearDown() { - parent::tearDown(); - $this->set_extension_group_permission(0); $iterator = new DirectoryIterator(__DIR__ . '/../../phpBB/files/'); foreach ($iterator as $fileinfo) @@ -59,6 +57,8 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case unlink($fileinfo->getPathname()); } + + parent::tearDown(); } public function get_urls() diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 6ce5d92ee1..5e1cf9b31f 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -117,8 +117,6 @@ class phpbb_functional_test_case extends phpbb_mink_test_case protected function tearDown() { - parent::tearDown(); - if ($this->db instanceof \phpbb\db\driver\driver_interface) { // Close the database connections again this test @@ -126,6 +124,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case } self::$cookieJar->clear(); + parent::tearDown(); } /** diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index 555574e053..86ac9feb09 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -59,8 +59,8 @@ abstract class phpbb_mink_test_case extends phpbb_test_case protected function tearDown() { - parent::tearDown(); self::$session->reset(); + parent::tearDown(); } static protected function visit($path) From 2d1a9980034ef40514fc310a065aa442c33b89a8 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 18:59:38 +0530 Subject: [PATCH 06/11] [ticket/11528] Use 'use' keyword to import classes to current scope PHPBB3-11528 --- tests/test_framework/phpbb_functional_test_case.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 5e1cf9b31f..2f0b0a3db0 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -11,6 +11,8 @@ * */ use Symfony\Component\BrowserKit\CookieJar; +use \Behat\Mink\Driver\Goutte\Client; +use \Behat\Mink\Driver\GoutteDriver; class phpbb_functional_test_case extends phpbb_mink_test_case { @@ -42,7 +44,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case self::$root_url = self::$config['phpbb_functional_url']; self::$cookieJar = new CookieJar; - self::$client = new \Behat\Mink\Driver\Goutte\Client(array(), null, self::$cookieJar); + self::$client = new Client(array(), null, self::$cookieJar); $client_options = array( Guzzle\Http\Client::DISABLE_REDIRECTS => true, @@ -57,7 +59,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case // resource self::$client->getClient()->getCurlMulti()->reset(true); - self::$driver = new \Behat\Mink\Driver\GoutteDriver(self::$client); + self::$driver = new GoutteDriver(self::$client); // Important: this is used both for installation and by // test cases for querying the tables. From f5aa9732d10052ff6d2f451c2772c4ea42afaa9b Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 14 Jun 2014 19:00:01 +0530 Subject: [PATCH 07/11] [ticket/11528] Add asserts in installation steps PHPBB3-11528 --- tests/test_framework/phpbb_mink_test_case.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index 86ac9feb09..f451054f5f 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -100,13 +100,16 @@ abstract class phpbb_mink_test_case extends phpbb_test_case $parseURL = parse_url(self::$config['phpbb_functional_url']); - self::visit('install/index.php?mode=install'); + $page = self::visit('install/index.php?mode=install'); + self::assertContains('Welcome to Installation', $page->findById('main')->getText()); // install/index.php?mode=install&sub=requirements $page = self::click_submit(); + self::assertContains('Installation compatibility', $page->findById('main')->getText()); // install/index.php?mode=install&sub=database $page = self::click_submit(); + self::assertContains('Database configuration', $page->findById('main')->getText()); $page->findById('dbms')->setValue(str_replace('phpbb\db\driver\\', '', self::$config['dbms'])); $page->findById('dbhost')->setValue(self::$config['dbhost']); @@ -116,18 +119,26 @@ abstract class phpbb_mink_test_case extends phpbb_test_case $page->findById('dbpasswd')->setValue(self::$config['dbpasswd']); $page->findById('table_prefix')->setValue(self::$config['table_prefix']); + // install/index.php?mode=install&sub=database $page = self::click_submit(); + self::assertContains('Successful connection', $page->findById('main')->getText()); + // install/index.php?mode=install&sub=administrator $page = self::click_submit(); + self::assertContains('Administrator configuration', $page->findById('main')->getText()); $page->findById('admin_name')->setValue('admin'); $page->findById('admin_pass1')->setValue('adminadmin'); $page->findById('admin_pass2')->setValue('adminadmin'); $page->findById('board_email')->setValue('nobody@example.com'); + // install/index.php?mode=install&sub=administrator $page = self::click_submit(); + self::assertContains('Tests passed', $page->findById('main')->getText()); + // install/index.php?mode=install&sub=config_file $page = self::click_submit(); + self::assertContains('The configuration file has been written', $page->findById('main')->getText()); // Installer has created a config.php file, we will overwrite it with a // config file of our own in order to get the DEBUG constants defined @@ -138,7 +149,9 @@ abstract class phpbb_mink_test_case extends phpbb_test_case self::markTestSkipped("Could not write $config_file file."); } + // install/index.php?mode=install&sub=advanced $page = self::click_submit(); + self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $page->findById('main')->getText()); $page->findById('smtp_delivery')->setValue('1'); $page->findById('smtp_host')->setValue('nxdomain.phpbb.com'); @@ -149,9 +162,14 @@ abstract class phpbb_mink_test_case extends phpbb_test_case $page->findById('server_port')->setValue(isset($parseURL['port']) ? $parseURL['port'] : 80); $page->findById('script_path')->setValue($parseURL['path']); + // install/index.php?mode=install&sub=create_table $page = self::click_submit(); + self::assertContains('The database tables used by phpBB', $page->findById('main')->getText()); + self::assertContains('have been created and populated with some initial data.', $page->findById('main')->getText()); + // install/index.php?mode=install&sub=final $page = self::click_submit(); + self::assertContains('You have successfully installed', $page->getText()); copy($config_file, $config_file_test); From a92c1d1ec0a660f5e2758a9865592d7f7ed0b76e Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 18 Jun 2014 15:29:46 +0530 Subject: [PATCH 08/11] [ticket/11528] Fix spaces and slashes as per guidelines PHPBB3-11528 --- tests/test_framework/phpbb_functional_test_case.php | 4 ++-- tests/test_framework/phpbb_mink_test_case.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 2f0b0a3db0..eef30fbcc7 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -11,8 +11,8 @@ * */ use Symfony\Component\BrowserKit\CookieJar; -use \Behat\Mink\Driver\Goutte\Client; -use \Behat\Mink\Driver\GoutteDriver; +use Behat\Mink\Driver\Goutte\Client; +use Behat\Mink\Driver\GoutteDriver; class phpbb_functional_test_case extends phpbb_mink_test_case { diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index f451054f5f..23b56eb91a 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -40,12 +40,12 @@ abstract class phpbb_mink_test_case extends phpbb_test_case { parent::setUp(); - if(!self::$driver) + if (!self::$driver) { self::markTestSkipped('Mink driver not initialized.'); } - if(!self::$session) + if (!self::$session) { self::$session = new Session(self::$driver); } From f0e115fdccad7b4636d506ec5ed85a8eca301317 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 19 Jun 2014 02:52:11 +0530 Subject: [PATCH 09/11] [ticket/11528] Change NULL to null PHPBB3-11528 --- tests/test_framework/phpbb_mink_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index 23b56eb91a..93b7beea99 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -22,7 +22,7 @@ abstract class phpbb_mink_test_case extends phpbb_test_case static protected $config = array(); static protected $root_url; - public function __construct($name = NULL, array $data = array(), $dataName = '') + public function __construct($name = null, array $data = array(), $dataName = '') { parent::__construct($name, $data, $dataName); From 2147a5eba5020b9f602b232da6a1f138479f77fa Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 23 Jun 2014 21:23:47 +0530 Subject: [PATCH 10/11] [ticket/11528] Handle case when config file cant be written by installer PHPBB3-11528 --- tests/test_framework/phpbb_mink_test_case.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index 93b7beea99..89042e46c1 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -138,7 +138,6 @@ abstract class phpbb_mink_test_case extends phpbb_test_case // install/index.php?mode=install&sub=config_file $page = self::click_submit(); - self::assertContains('The configuration file has been written', $page->findById('main')->getText()); // Installer has created a config.php file, we will overwrite it with a // config file of our own in order to get the DEBUG constants defined @@ -149,6 +148,12 @@ abstract class phpbb_mink_test_case extends phpbb_test_case self::markTestSkipped("Could not write $config_file file."); } + if (strpos($page->findById('main')->getText(), 'The configuration file has been written') === false) + { + $page = self::click_submit('dldone'); + } + self::assertContains('The configuration file has been written', $page->findById('main')->getText()); + // install/index.php?mode=install&sub=advanced $page = self::click_submit(); self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $page->findById('main')->getText()); From 61fa0908bcfa1787baba1bb10bf6c980db90fba7 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 23 Jun 2014 19:52:54 +0530 Subject: [PATCH 11/11] [ticket/11528] Change click_submit() to accept id as param PHPBB3-11528 --- tests/test_framework/phpbb_mink_test_case.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php index 89042e46c1..ba480e35fb 100644 --- a/tests/test_framework/phpbb_mink_test_case.php +++ b/tests/test_framework/phpbb_mink_test_case.php @@ -69,9 +69,9 @@ abstract class phpbb_mink_test_case extends phpbb_test_case return self::$session->getPage(); } - static protected function click_submit() + static protected function click_submit($submit_button_id = 'submit') { - self::$session->getPage()->findById('submit')->click(); + self::$session->getPage()->findById($submit_button_id)->click(); return self::$session->getPage(); }