Added test for SQLController
Dieser Commit ist enthalten in:
Ursprung
2bbe324c63
Commit
74568da450
1 geänderte Dateien mit 24 neuen und 5 gelöschten Zeilen
|
@ -43,6 +43,21 @@ class Msd_Application_Controller_SqlControllerTest
|
|||
$this->assertQueryContentContains('table > tr > td', $expected);
|
||||
}
|
||||
|
||||
public function testShowTableDataCanDetectEmptyDatabase()
|
||||
{
|
||||
//create empty testDb
|
||||
$db = Msd_Db::getAdapter();
|
||||
$db->query('DROP DATABASE IF EXISTS `testDb`');
|
||||
$sql = 'CREATE DATABASE `testDb` DEFAULT CHARSET utf8 DEFAULT COLLATE utf8_general_ci';
|
||||
$db->query($sql);
|
||||
$this->dispatch('sql/show.table.data/dbName/' . base64_encode('testDb') . '/tableName/IDontExits');
|
||||
// make sure we see an error message
|
||||
$this->assertXpathCount('//p[@class="error"]', 1);
|
||||
// make sure message is "Database is empty!"
|
||||
$expected = 'Die Datenbank ist leer!';
|
||||
$this->assertQueryContentContains('p', $expected);
|
||||
}
|
||||
|
||||
public function testCanFallbackToShowingDataOfFirstTableOnIncorrectTable()
|
||||
{
|
||||
$this->loginUser();
|
||||
|
@ -79,10 +94,13 @@ class Msd_Application_Controller_SqlControllerTest
|
|||
$db->query('DROP DATABASE IF EXISTS `testDb`');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCanCreateADatabase
|
||||
*/
|
||||
public function testCanDropADatabase()
|
||||
{
|
||||
$this->loginUser();
|
||||
//create our testDb if it exists
|
||||
//create our testDb
|
||||
$db = Msd_Db::getAdapter();
|
||||
$sql = 'CREATE DATABASE `testDb` DEFAULT CHARSET utf8 DEFAULT COLLATE utf8_general_ci';
|
||||
$db->query($sql);
|
||||
|
@ -109,4 +127,5 @@ class Msd_Application_Controller_SqlControllerTest
|
|||
$expected = '<option value="aW5mb3JtYXRpb25fc2NoZW1h" selected="selected">information_schema</option>';
|
||||
$this->assertQueryContentContains('select', $expected);
|
||||
}
|
||||
|
||||
}
|
Laden …
In neuem Issue referenzieren