Merge pull request #4602 from Nicofuma/ticket/14947

[ticket/14947] Updates phpunit to 4.8
This commit is contained in:
Marc Alexander 2017-01-02 22:52:16 +01:00
commit 56314f4c22
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
5 changed files with 306 additions and 90 deletions

View file

@ -55,7 +55,7 @@
"laravel/homestead": "~2.2", "laravel/homestead": "~2.2",
"phing/phing": "2.4.*", "phing/phing": "2.4.*",
"phpunit/dbunit": "1.3.*", "phpunit/dbunit": "1.3.*",
"phpunit/phpunit": "4.1.*", "phpunit/phpunit": "^4.1",
"sami/sami": "1.*", "sami/sami": "1.*",
"squizlabs/php_codesniffer": "2.*", "squizlabs/php_codesniffer": "2.*",
"symfony/browser-kit": "^2.8", "symfony/browser-kit": "^2.8",

304
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", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "067b099cc97334a6a08a77e5648aa260", "hash": "8d03337c5b9f6ae7cc1a26f84ba0270b",
"content-hash": "90198ca524b93a7e915aa6916b2f55af", "content-hash": "be4cb6437adc268d96f99bcbaad66d03",
"packages": [ "packages": [
{ {
"name": "bantu/ini-get-wrapper", "name": "bantu/ini-get-wrapper",
@ -1894,6 +1894,60 @@
} }
], ],
"packages-dev": [ "packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14 21:17:01"
},
{ {
"name": "fabpot/goutte", "name": "fabpot/goutte",
"version": "v2.0.4", "version": "v2.0.4",
@ -2178,6 +2232,118 @@
], ],
"time": "2012-11-29 21:23:47" "time": "2012-11-29 21:23:47"
}, },
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"phpDocumentor": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"time": "2015-02-03 12:10:50"
},
{
"name": "phpspec/prophecy",
"version": "v1.6.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"sebastian/comparator": "^1.1",
"sebastian/recursion-context": "^1.0|^2.0"
},
"require-dev": {
"phpspec/phpspec": "^2.0",
"phpunit/phpunit": "^4.8 || ^5.6.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2016-11-21 14:58:47"
},
{ {
"name": "phpunit/dbunit", "name": "phpunit/dbunit",
"version": "1.3.2", "version": "1.3.2",
@ -2301,31 +2467,33 @@
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
"version": "1.3.4", "version": "1.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": { "autoload": {
"classmap": [ "classmap": [
"File/" "src/"
] ]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@ -2342,7 +2510,7 @@
"filesystem", "filesystem",
"iterator" "iterator"
], ],
"time": "2013-10-10 15:34:57" "time": "2016-10-03 07:40:28"
}, },
{ {
"name": "phpunit/php-text-template", "name": "phpunit/php-text-template",
@ -2480,16 +2648,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "4.1.6", "version": "4.8.31",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "241116219bb7e3b8111a36ffd8f37546888738d6" "reference": "98b2b39a520766bec663ff5b7ff1b729db9dbfe3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241116219bb7e3b8111a36ffd8f37546888738d6", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/98b2b39a520766bec663ff5b7ff1b729db9dbfe3",
"reference": "241116219bb7e3b8111a36ffd8f37546888738d6", "reference": "98b2b39a520766bec663ff5b7ff1b729db9dbfe3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2499,17 +2667,19 @@
"ext-reflection": "*", "ext-reflection": "*",
"ext-spl": "*", "ext-spl": "*",
"php": ">=5.3.3", "php": ">=5.3.3",
"phpunit/php-code-coverage": "~2.0", "phpspec/prophecy": "^1.3.1",
"phpunit/php-file-iterator": "~1.3.1", "phpunit/php-code-coverage": "~2.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2", "phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "2.1.5", "phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.0", "sebastian/comparator": "~1.2.2",
"sebastian/diff": "~1.1", "sebastian/diff": "~1.2",
"sebastian/environment": "~1.0", "sebastian/environment": "~1.3",
"sebastian/exporter": "~1.0", "sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0", "sebastian/version": "~1.0",
"symfony/yaml": "~2.0" "symfony/yaml": "~2.1|~3.0"
}, },
"suggest": { "suggest": {
"phpunit/php-invoker": "~1.1" "phpunit/php-invoker": "~1.1"
@ -2520,7 +2690,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.1.x-dev" "dev-master": "4.8.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2529,10 +2699,6 @@
] ]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@ -2544,34 +2710,36 @@
} }
], ],
"description": "The PHP Unit Testing framework.", "description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/", "homepage": "https://phpunit.de/",
"keywords": [ "keywords": [
"phpunit", "phpunit",
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2014-08-17 08:07:02" "time": "2016-12-09 02:45:31"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "2.1.5", "version": "2.3.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "7878b9c41edb3afab92b85edf5f0981014a2713a" "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7878b9c41edb3afab92b85edf5f0981014a2713a", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"reference": "7878b9c41edb3afab92b85edf5f0981014a2713a", "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3", "php": ">=5.3.3",
"phpunit/php-text-template": "~1.2" "phpunit/php-text-template": "~1.2",
"sebastian/exporter": "~1.2"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.1" "phpunit/phpunit": "~4.4"
}, },
"suggest": { "suggest": {
"ext-soap": "*" "ext-soap": "*"
@ -2579,7 +2747,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.1.x-dev" "dev-master": "2.3.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2588,9 +2756,6 @@
] ]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@ -2607,7 +2772,7 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2014-06-12 07:22:15" "time": "2015-10-02 06:51:40"
}, },
{ {
"name": "pimple/pimple", "name": "pimple/pimple",
@ -2644,9 +2809,7 @@
"authors": [ "authors": [
{ {
"name": "Fabien Potencier", "name": "Fabien Potencier",
"email": "fabien@symfony.com", "email": "fabien@symfony.com"
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
} }
], ],
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3", "description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
@ -2947,6 +3110,57 @@
], ],
"time": "2016-06-17 09:04:28" "time": "2016-06-17 09:04:28"
}, },
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12 03:26:01"
},
{ {
"name": "sebastian/recursion-context", "name": "sebastian/recursion-context",
"version": "1.0.4", "version": "1.0.4",

View file

@ -78,15 +78,12 @@ class phpbb_ui_test_case extends phpbb_test_case
self::markTestSkipped('phpbb_functional_url was not set in test_config and wasn\'t set as PHPBB_FUNCTIONAL_URL environment variable either.'); self::markTestSkipped('phpbb_functional_url was not set in test_config and wasn\'t set as PHPBB_FUNCTIONAL_URL environment variable either.');
} }
if (!self::$webDriver)
{
try { try {
$capabilities = DesiredCapabilities::firefox(); $capabilities = DesiredCapabilities::firefox();
self::$webDriver = RemoteWebDriver::create(self::$host . ':' . self::$port, $capabilities); self::$webDriver = RemoteWebDriver::create(self::$host . ':' . self::$port, $capabilities);
} catch (WebDriverCurlException $e) { } catch (WebDriverCurlException $e) {
self::markTestSkipped('PhantomJS webserver is not running.'); self::markTestSkipped('PhantomJS webserver is not running.');
} }
}
if (!self::$already_installed) if (!self::$already_installed)
{ {
@ -146,9 +143,14 @@ class phpbb_ui_test_case extends phpbb_test_case
} }
} }
static public function visit($path) public function getDriver()
{ {
self::$webDriver->get(self::$root_url . $path); return self::$webDriver;
}
public function visit($path)
{
$this->getDriver()->get(self::$root_url . $path);
} }
static protected function recreate_database($config) static protected function recreate_database($config)
@ -157,14 +159,14 @@ class phpbb_ui_test_case extends phpbb_test_case
$db_conn_mgr->recreate_db(); $db_conn_mgr->recreate_db();
} }
static public function find_element($type, $value) public function find_element($type, $value)
{ {
return self::$webDriver->findElement(WebDriverBy::$type($value)); return $this->getDriver()->findElement(WebDriverBy::$type($value));
} }
static public function submit($type = 'id', $value = 'submit') public function submit($type = 'id', $value = 'submit')
{ {
$element = self::find_element($type, $value); $element = $this->find_element($type, $value);
$element->click(); $element->click();
} }
@ -305,21 +307,21 @@ class phpbb_ui_test_case extends phpbb_test_case
$ext_path = str_replace('/', '%2F', $extension); $ext_path = str_replace('/', '%2F', $extension);
$this->visit('adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid); $this->visit('adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
$this->assertNotEmpty(count(self::find_element('cssSelector', '.submit-buttons'))); $this->assertNotEmpty(count($this->find_element('cssSelector', '.submit-buttons')));
self::find_element('cssSelector', "input[value='Enable']")->submit(); $this->find_element('cssSelector', "input[value='Enable']")->submit();
$this->add_lang('acp/extensions'); $this->add_lang('acp/extensions');
try try
{ {
$meta_refresh = self::find_element('cssSelector', 'meta[http-equiv="refresh"]'); $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
// Wait for extension to be fully enabled // Wait for extension to be fully enabled
while (sizeof($meta_refresh)) while (sizeof($meta_refresh))
{ {
preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match); preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match);
self::$webDriver->execute(array('method' => 'post', 'url' => $match[1])); $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1]));
$meta_refresh = self::find_element('cssSelector', 'meta[http-equiv="refresh"]'); $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
} }
} }
catch (\Facebook\WebDriver\Exception\NoSuchElementException $e) catch (\Facebook\WebDriver\Exception\NoSuchElementException $e)
@ -327,7 +329,7 @@ class phpbb_ui_test_case extends phpbb_test_case
// Probably no refresh triggered // Probably no refresh triggered
} }
$this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', self::find_element('cssSelector', 'div.successbox')->getText()); $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $this->find_element('cssSelector', 'div.successbox')->getText());
$this->logout(); $this->logout();
} }
@ -415,7 +417,7 @@ class phpbb_ui_test_case extends phpbb_test_case
} }
$this->visit('ucp.php?sid=' . $this->sid . '&mode=logout'); $this->visit('ucp.php?sid=' . $this->sid . '&mode=logout');
$this->assertContains($this->lang('REGISTER'), self::$webDriver->getPageSource()); $this->assertContains($this->lang('REGISTER'), $this->getDriver()->getPageSource());
unset($this->sid); unset($this->sid);
} }
@ -435,17 +437,17 @@ class phpbb_ui_test_case extends phpbb_test_case
return; return;
} }
self::$webDriver->manage()->deleteAllCookies(); $this->getDriver()->manage()->deleteAllCookies();
$this->visit('adm/index.php?sid=' . $this->sid); $this->visit('adm/index.php?sid=' . $this->sid);
$this->assertContains($this->lang('LOGIN_ADMIN_CONFIRM'), self::$webDriver->getPageSource()); $this->assertContains($this->lang('LOGIN_ADMIN_CONFIRM'), $this->getDriver()->getPageSource());
self::find_element('cssSelector', 'input[name=username]')->clear()->sendKeys($username); $this->find_element('cssSelector', 'input[name=username]')->clear()->sendKeys($username);
self::find_element('cssSelector', 'input[type=password]')->sendKeys($username . $username); $this->find_element('cssSelector', 'input[type=password]')->sendKeys($username . $username);
self::find_element('cssSelector', 'input[name=login]')->click(); $this->find_element('cssSelector', 'input[name=login]')->click();
$this->assertContains($this->lang('ADMIN_PANEL'), $this->find_element('cssSelector', 'h1')->getText()); $this->assertContains($this->lang('ADMIN_PANEL'), $this->find_element('cssSelector', 'h1')->getText());
$cookies = self::$webDriver->manage()->getCookies(); $cookies = $this->getDriver()->manage()->getCookies();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
foreach ($cookies as $cookie) foreach ($cookies as $cookie)
@ -550,19 +552,19 @@ class phpbb_ui_test_case extends phpbb_test_case
{ {
$this->add_lang('ucp'); $this->add_lang('ucp');
self::$webDriver->manage()->deleteAllCookies(); $this->getDriver()->manage()->deleteAllCookies();
$this->visit('ucp.php'); $this->visit('ucp.php');
$this->assertContains($this->lang('LOGIN_EXPLAIN_UCP'), self::$webDriver->getPageSource()); $this->assertContains($this->lang('LOGIN_EXPLAIN_UCP'), $this->getDriver()->getPageSource());
self::$webDriver->manage()->deleteAllCookies(); $this->getDriver()->manage()->deleteAllCookies();
self::find_element('cssSelector', 'input[name=username]')->sendKeys($username); $this->find_element('cssSelector', 'input[name=username]')->sendKeys($username);
self::find_element('cssSelector', 'input[name=password]')->sendKeys($username . $username); $this->find_element('cssSelector', 'input[name=password]')->sendKeys($username . $username);
self::find_element('cssSelector', 'input[name=login]')->click(); $this->find_element('cssSelector', 'input[name=login]')->click();
$this->assertNotContains($this->lang('LOGIN'), $this->find_element('className', 'navbar')->getText()); $this->assertNotContains($this->lang('LOGIN'), $this->find_element('className', 'navbar')->getText());
$cookies = self::$webDriver->manage()->getCookies(); $cookies = $this->getDriver()->manage()->getCookies();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
foreach ($cookies as $cookie) foreach ($cookies as $cookie)
@ -586,6 +588,6 @@ class phpbb_ui_test_case extends phpbb_test_case
// Change the Path to your own settings // Change the Path to your own settings
$screenshot = time() . ".png"; $screenshot = time() . ".png";
self::$webDriver->takeScreenshot($screenshot); $this->getDriver()->takeScreenshot($screenshot);
} }
} }

View file

@ -25,19 +25,19 @@ class ui_permission_roles_test extends phpbb_ui_test_case
$this->visit('adm/index.php?i=acp_permissions&mode=setting_forum_local&sid=' . $this->sid); $this->visit('adm/index.php?i=acp_permissions&mode=setting_forum_local&sid=' . $this->sid);
// Select forums // Select forums
$elements = self::find_element('cssSelector', 'select#forum') $elements = $this->find_element('cssSelector', 'select#forum')
->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option')); ->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option'));
foreach ($elements as $element) foreach ($elements as $element)
{ {
$element->click(); $element->click();
} }
self::find_element('cssSelector', 'form#select_victim') $this->find_element('cssSelector', 'form#select_victim')
->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=submit]')) ->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=submit]'))
->click(); ->click();
// Select administrators and guests // Select administrators and guests
$groups_form = self::find_element('cssSelector', 'form#groups'); $groups_form = $this->find_element('cssSelector', 'form#groups');
$elements = $groups_form $elements = $groups_form
->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('select')) ->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('select'))
->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option')); ->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option'));
@ -51,7 +51,7 @@ class ui_permission_roles_test extends phpbb_ui_test_case
} }
$groups_form->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[name=submit_edit_options]'))->click(); $groups_form->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[name=submit_edit_options]'))->click();
$first_fieldset = self::find_element('cssSelector', '#perm11'); $first_fieldset = $this->find_element('cssSelector', '#perm11');
$this->assertEquals('none', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display')); $this->assertEquals('none', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
$first_fieldset $first_fieldset
->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle')) ->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))
@ -74,14 +74,14 @@ class ui_permission_roles_test extends phpbb_ui_test_case
$this->assertEquals($this->lang('ROLE_FORUM_LIMITED'), $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText()); $this->assertEquals($this->lang('ROLE_FORUM_LIMITED'), $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
// Check that admin settings didn't get changed // Check that admin settings didn't get changed
$second_fieldset = self::find_element('cssSelector', '#perm10'); $second_fieldset = $this->find_element('cssSelector', '#perm10');
$this->assertEquals('none', $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display')); $this->assertEquals('none', $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
// Full access = 14 // Full access = 14
$this->assertEquals(14, $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value')); $this->assertEquals(14, $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
$this->assertEquals($this->lang('ROLE_FORUM_FULL'), $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText()); $this->assertEquals($this->lang('ROLE_FORUM_FULL'), $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
// Check that category settings were not modified // Check that category settings were not modified
$category_fieldset = self::find_element('cssSelector', '#perm00'); $category_fieldset = $this->find_element('cssSelector', '#perm00');
$this->assertEquals('none', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display')); $this->assertEquals('none', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
// No settings // No settings
$this->assertEquals('', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value')); $this->assertEquals('', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));

View file

@ -19,8 +19,8 @@ class quick_links_test extends phpbb_ui_test_case
public function test_quick_links() public function test_quick_links()
{ {
$this->visit('index.php'); $this->visit('index.php');
$this->assertEmpty(self::find_element('className', 'dropdown')->getText()); $this->assertEmpty($this->find_element('className', 'dropdown')->getText());
self::find_element('className', 'dropdown-toggle')->click(); $this->find_element('className', 'dropdown-toggle')->click();
$this->assertNotNull(self::find_element('className', 'dropdown')->getText()); $this->assertNotNull($this->find_element('className', 'dropdown')->getText());
} }
} }