blob: 65c492cc2212f6ba9fed8d64fc407f9030d0e5b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Selenium TestCase for creating and deleting databases
*
* @package PhpMyAdmin-test
* @subpackage Selenium
*/
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Selenium;
/**
* CreateDropDatabaseTest class
*
* @package PhpMyAdmin-test
* @subpackage Selenium
* @group selenium
*/
class CreateDropDatabaseTest extends TestBase
{
/**
* Setup the browser environment to run the selenium test case
*
* @return void
*/
public function setUp()
{
parent::setUp();
/* TODO: For now this tests needs superuser for deleting database */
$this->skipIfNotSuperUser();
}
public function setUpPage()
{
parent::setUpPage();
$this->login();
}
/**
* Creates a database and drops it
*
* @return void
*
* @group large
*/
public function testCreateDropDatabase()
{
// Drop database if it exists
$this->dbQuery(
'DROP DATABASE IF EXISTS ' . $this->database_name . ';'
);
$this->waitForElement('byPartialLinkText','Databases')->click();
$this->waitAjax();
$element = $this->waitForElement('byId', 'text_create_db');
$element->clear();
$element->value($this->database_name);
$this->byId("buttonGo")->click();
$element = $this->waitForElement('byLinkText', 'Database: ' . $this->database_name);
$result = $this->dbQuery(
'SHOW DATABASES LIKE \'' . $this->database_name . '\';'
);
$this->assertEquals(1, $result->num_rows);
$this->_dropDatabase();
}
/**
* Drops a database, called after testCreateDropDatabase
*
* @return void
*/
private function _dropDatabase()
{
$this->gotoHomepage();
$this->byPartialLinkText('Databases')->click();
$this->waitAjax();
$this->scrollToBottom();
$this->byCssSelector(
"input[name='selected_dbs[]'][value='" . $this->database_name . "']"
)->click();
$this->byCssSelector("button.mult_submit")->click();
$this->byCssSelector("button.submitOK")->click();
$this->waitForElementNotPresent(
"byCssSelector",
"input[name='selected_dbs[]'][value='" . $this->database_name . "']"
);
$this->waitForElement(
"byCssSelector", "span.ajax_notification div.success"
);
$result = $this->dbQuery(
'SHOW DATABASES LIKE \'' . $this->database_name . '\';'
);
$this->assertEquals(0, $result->num_rows);
}
}
|