diff options
author | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2018-04-13 06:48:19 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2018-04-13 06:48:19 +0300 |
commit | 8c0637a2829edd4b721eceeba4a6dd2a5bfb35fb (patch) | |
tree | e9560037a0538d335c74487f6b8dd40457594a4b /test | |
parent | 6f2f77c35bee3fad35aab3412743d0289e05192c (diff) |
Upgrade Selenium tests to PHPUnit 6.5
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/selenium/ChangePasswordTest.php | 8 | ||||
-rw-r--r-- | test/selenium/TableBrowseTest.php | 4 | ||||
-rw-r--r-- | test/selenium/TestBase.php | 19 |
3 files changed, 21 insertions, 10 deletions
diff --git a/test/selenium/ChangePasswordTest.php b/test/selenium/ChangePasswordTest.php index 3488d7dabd..e3749853a9 100644 --- a/test/selenium/ChangePasswordTest.php +++ b/test/selenium/ChangePasswordTest.php @@ -9,6 +9,8 @@ namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit\Framework\AssertionFailedError; + /** * PrivilegesTest class * @@ -38,19 +40,19 @@ class ChangePasswordTest extends TestBase try { $ele = $this->waitForElement("byName", "pma_pw"); $this->assertEquals("", $ele->value()); - } catch (\PHPUnit_Framework_AssertionFailedError $e) { + } catch (AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } try { $ele = $this->waitForElement("byName", "pma_pw2"); $this->assertEquals("", $ele->value()); - } catch (\PHPUnit_Framework_AssertionFailedError $e) { + } catch (AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } try { $ele = $this->waitForElement("byName", "generated_pw"); $this->assertEquals("", $ele->value()); - } catch (\PHPUnit_Framework_AssertionFailedError $e) { + } catch (AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } $this->byId("button_generate_password")->click(); diff --git a/test/selenium/TableBrowseTest.php b/test/selenium/TableBrowseTest.php index edfcf21c69..335847657f 100644 --- a/test/selenium/TableBrowseTest.php +++ b/test/selenium/TableBrowseTest.php @@ -9,6 +9,8 @@ namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit_Extensions_Selenium2TestCase_Keys as Keys; + /** * TableBrowseTest class * @@ -231,7 +233,7 @@ class TableBrowseTest extends TestBase $this->byCssSelector("textarea.edit_box")->clear(); $this->byCssSelector("textarea.edit_box")->value("abcde"); - $this->keys(\PHPUnit_Extensions_Selenium2TestCase_Keys::RETURN_); + $this->keys(Keys::RETURN_); $this->waitAjax(); $success = $this->waitForElement( diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index 9ff15ae004..e679a818c5 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -8,6 +8,11 @@ */ namespace PhpMyAdmin\Tests\Selenium; +use PHPUnit_Extensions_Selenium2TestCase as Selenium2TestCase; +use PHPUnit_Extensions_Selenium2TestCase_WebDriverException as WebDriverException; +use PHPUnit\Framework\SkippedTestError; +use PHPUnit\Framework\IncompleteTestError; + /** * Base class for Selenium tests. * @@ -15,7 +20,7 @@ namespace PhpMyAdmin\Tests\Selenium; * @subpackage Selenium * @group selenium */ -abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase +abstract class TestBase extends Selenium2TestCase { /** * mysqli object @@ -430,7 +435,7 @@ abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase $element = call_user_func_array( array($this, $func), array($arg) ); - } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { + } catch (WebDriverException $e) { // Element not present return false; } catch (\InvalidArgumentException $e) { @@ -570,7 +575,7 @@ abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase $ele = null; try { $ele = $this->waitForElement('byCssSelector', 'li.submenu > a'); - } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { + } catch (WebDriverException $e) { return; } @@ -714,16 +719,18 @@ abstract class TestBase extends \PHPUnit_Extensions_Selenium2TestCase /** * Mark unsuccessful tests as 'Failures' on Browerstack * + * @param \Throwable $e + * * @return void */ - public function onNotSuccessfulTest($e) + public function onNotSuccessfulTest(\Throwable $e) { // If this is being run on Browerstack, // mark the test on Browerstack as failure if (! empty($GLOBALS['TESTSUITE_BROWSERSTACK_USER']) && ! empty($GLOBALS['TESTSUITE_BROWSERSTACK_KEY']) - && ! ($e instanceof PHPUnit_Framework_SkippedTestError) - && ! ($e instanceof PHPUnit_Framework_IncompleteTestError) + && ! ($e instanceof SkippedTestError) + && ! ($e instanceof IncompleteTestError) ) { $SESSION_REST_URL = 'https://www.browserstack.com/automate/sessions/'; $sessionId = $this->getSessionId(); |