Fix generate password button when adding users
[phpmyadmin.git] / test / selenium / DbStructureTest.php
blob96bbd4925c95b38cb345ef23ceff489747fc3d1e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Selenium TestCase for table related tests
6 * @package PhpMyAdmin-test
7 * @subpackage Selenium
8 */
10 namespace PhpMyAdmin\Tests\Selenium;
12 /**
13 * DbStructureTest class
15 * @package PhpMyAdmin-test
16 * @subpackage Selenium
17 * @group selenium
19 class DbStructureTest extends TestBase
21 /**
22 * Setup the browser environment to run the selenium test case
24 * @return void
26 public function setUp()
28 parent::setUp();
29 $this->dbQuery(
30 "CREATE TABLE `test_table` ("
31 . " `id` int(11) NOT NULL AUTO_INCREMENT,"
32 . " `val` int(11) NOT NULL,"
33 . " PRIMARY KEY (`id`)"
34 . ")"
36 $this->dbQuery(
37 "CREATE TABLE `test_table2` ("
38 . " `id` int(11) NOT NULL AUTO_INCREMENT,"
39 . " `val` int(11) NOT NULL,"
40 . " PRIMARY KEY (`id`)"
41 . ")"
43 $this->dbQuery(
44 "INSERT INTO `test_table` (val) VALUES (2);"
48 /**
49 * setUp function that can use the selenium session (called before each test)
51 * @return void
53 public function setUpPage()
55 parent::setUpPage();
57 $this->login();
58 $this->navigateDatabase($this->database_name);
60 // Let the Database page load
61 $this->waitAjax();
62 $this->expandMore();
65 /**
66 * Test for truncating a table
68 * @return void
70 * @group large
72 public function testTruncateTable()
74 $this->byXPath("(//a[contains(., 'Empty')])[1]")->click();
76 $this->waitForElement(
77 "byCssSelector",
78 "button.submitOK"
79 )->click();
81 $this->assertNotNull(
82 $this->waitForElement(
83 "byXPath",
84 "//div[@class='success' and contains(., "
85 . "'MySQL returned an empty result')]"
89 $result = $this->dbQuery("SELECT count(*) as c FROM test_table");
90 $row = $result->fetch_assoc();
91 $this->assertEquals(0, $row['c']);
94 /**
95 * Tests for dropping multiple tables
97 * @return void
99 * @group large
101 public function testDropMultipleTables()
103 $this->byCssSelector("label[for='tablesForm_checkall']")->click();
104 $this->select($this->byName("submit_mult"))
105 ->selectOptionByLabel("Drop");
106 $this->waitForElement("byId", "buttonYes")
107 ->click();
109 $this->waitForElement(
110 "byXPath",
111 "//*[contains(., 'No tables found in database')]"
114 $result = $this->dbQuery("SHOW TABLES;");
115 $this->assertEquals(0, $result->num_rows);