Convert database operations test to new model
Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
f7ea90de6d
commit
9ac96ef407
@ -33,6 +33,7 @@
|
||||
<file>test/selenium/PmaSeleniumLoginTest.php</file>
|
||||
<file>test/selenium/PmaSeleniumXssTest.php</file>
|
||||
<file>test/selenium/PmaSeleniumDbStructureTest.php</file>
|
||||
<file>test/selenium/PmaSeleniumDbOperationsTest.php</file>
|
||||
<!--<directory suffix="Test.php">test/selenium</directory>-->
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
@ -6,7 +6,9 @@
|
||||
* @package PhpMyAdmin-test
|
||||
* @subpackage Selenium
|
||||
*/
|
||||
require_once 'Helper.php';
|
||||
|
||||
require_once 'TestBase.php';
|
||||
|
||||
|
||||
/**
|
||||
* PmaSeleniumDbOperationsTest class
|
||||
@ -14,7 +16,7 @@ require_once 'Helper.php';
|
||||
* @package PhpMyAdmin-test
|
||||
* @subpackage Selenium
|
||||
*/
|
||||
class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
class PmaSeleniumDbOperationsTest extends PMA_SeleniumBase
|
||||
{
|
||||
/**
|
||||
* Name of database for the test
|
||||
@ -23,13 +25,6 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
private $_dbname;
|
||||
|
||||
/**
|
||||
* Helper Object
|
||||
*
|
||||
* @var Helper
|
||||
*/
|
||||
private $_helper;
|
||||
|
||||
/**
|
||||
* Setup the browser environment to run the selenium test case
|
||||
*
|
||||
@ -37,13 +32,11 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->_helper = new Helper($this);
|
||||
$this->setBrowser($this->_helper->getBrowserString());
|
||||
$this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL);
|
||||
$this->_helper->dbConnect();
|
||||
$this->_dbname = 'pma_db_test';
|
||||
$this->_helper->dbQuery('CREATE DATABASE ' . $this->_dbname);
|
||||
$this->_helper->dbQuery('USE ' . $this->_dbname);
|
||||
parent::setUp();
|
||||
$this->dbConnect();
|
||||
$this->_dbname = TESTSUITE_DATABASE;
|
||||
$this->dbQuery('CREATE DATABASE ' . $this->_dbname);
|
||||
$this->dbQuery('USE ' . $this->_dbname);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,10 +46,10 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
$this->_helper->login(TESTSUITE_USER, TESTSUITE_PASSWORD);
|
||||
$this->login(TESTSUITE_USER, TESTSUITE_PASSWORD);
|
||||
$this->byLinkText($this->_dbname)->click();
|
||||
$this->_helper->waitForElement("byLinkText", "Operations")->click();
|
||||
$this->_helper->waitForElement(
|
||||
$this->waitForElement("byLinkText", "Operations")->click();
|
||||
$this->waitForElement(
|
||||
"byXPath", "//legend[contains(., 'Database comment:')]"
|
||||
);
|
||||
}
|
||||
@ -72,7 +65,7 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
$this->byXPath("(//input[@value='Go'])[1]")->click();
|
||||
|
||||
$this->assertNotNull(
|
||||
$this->_helper->waitForElement(
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//span[@id='span_table_comment' and contains(., 'comment_foobar')]"
|
||||
)
|
||||
@ -91,21 +84,21 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
|
||||
$this->byXPath("(//input[@value='Go'])[3]")->click();
|
||||
|
||||
$this->_helper->waitForElement(
|
||||
$this->waitForElement(
|
||||
"byXPath", "//button[contains(., 'OK')]"
|
||||
)->click();
|
||||
|
||||
$this->_helper->waitForElement(
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//a[@class='item' and contains(., 'Database: pma_test_db_renamed')]"
|
||||
);
|
||||
|
||||
$result = $this->_helper->dbQuery(
|
||||
$result = $this->dbQuery(
|
||||
"SHOW DATABASES LIKE 'pma_test_db_renamed';"
|
||||
);
|
||||
$this->assertEquals(1, $result->num_rows);
|
||||
|
||||
$result = $this->_helper->dbQuery(
|
||||
$result = $this->dbQuery(
|
||||
"SHOW DATABASES LIKE '" . $this->_dbname . "';"
|
||||
);
|
||||
$this->assertEquals(0, $result->num_rows);
|
||||
@ -125,18 +118,18 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
|
||||
$this->byXPath("(//input[@value='Go'])[4]")->click();
|
||||
|
||||
$this->_helper->waitForElement(
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//div[@class='success' and contains(., 'Database " . $this->_dbname
|
||||
. " has been copied to pma_test_db_copy')]"
|
||||
);
|
||||
|
||||
$result = $this->_helper->dbQuery(
|
||||
$result = $this->dbQuery(
|
||||
"SHOW DATABASES LIKE 'pma_test_db_copy';"
|
||||
);
|
||||
$this->assertEquals(1, $result->num_rows);
|
||||
|
||||
$this->_helper->dbQuery("DROP DATABASE pma_test_db_copy");
|
||||
$this->dbQuery("DROP DATABASE pma_test_db_copy");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,6 +139,6 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
$this->_helper->dbQuery('DROP DATABASE ' . $this->_dbname);
|
||||
$this->dbQuery('DROP DATABASE ' . $this->_dbname);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user