Translated using Weblate (Slovenian)
[phpmyadmin.git] / test / selenium / PmaSeleniumDbStructureTest.php
blob531d2bec198773ada024304c7898fd4897fa6a22
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 require_once 'TestBase.php';
12 /**
13 * PmaSeleniumDbStructureTest class
15 * @package PhpMyAdmin-test
16 * @subpackage Selenium
17 * @group selenium
19 class PMA_SeleniumDbStructureTest extends PMA_SeleniumBase
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 $this->login();
56 $this->waitForElement('byLinkText', $this->database_name)->click();
57 $this->waitForElement(
58 'byCssSelector',
59 'li.last.table'
61 $this->waitForElement(
62 "byXPath", "//a[contains(., 'test_table')]"
66 /**
67 * Test for truncating a table
69 * @return void
71 * @group large
73 public function testTruncateTable()
75 $this->byXPath("(//a[contains(., 'Empty')])[1]")->click();
77 $this->waitForElement(
78 "byXPath",
79 "//button[contains(., 'OK')]"
80 )->click();
82 $this->assertNotNull(
83 $this->waitForElement(
84 "byXPath",
85 "//div[@class='success' and contains(., "
86 . "'MySQL returned an empty result')]"
90 $result = $this->dbQuery("SELECT count(*) as c FROM test_table");
91 $row = $result->fetch_assoc();
92 $this->assertEquals(0, $row['c']);
95 /**
96 * Tests for dropping multiple tables
98 * @return void
100 * @group large
102 public function testDropMultipleTables()
104 $this->byCssSelector("label[for='tablesForm_checkall']")->click();
105 $this->select($this->byName("submit_mult"))
106 ->selectOptionByLabel("Drop");
107 $this->waitForElement("byId", "buttonYes")
108 ->click();
110 $this->waitForElement(
111 "byXPath",
112 "//p[contains(., 'No tables found in database')]"
115 $result = $this->dbQuery("SHOW TABLES;");
116 $this->assertEquals(0, $result->num_rows);