From cc1e1f30b69323ead7612cd500b74811b16a86c3 Mon Sep 17 00:00:00 2001 From: DSB Date: Tue, 14 Jun 2011 20:02:42 +0000 Subject: [PATCH] Added test: create a database --- application/controllers/SqlController.php | 1 - .../controllers/SqlControllerTest.php | 21 +++++++++++++++++++ tests/unit/library/Msd/LogTest.php | 7 ------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/application/controllers/SqlController.php b/application/controllers/SqlController.php index 426882a..ceaecc7 100644 --- a/application/controllers/SqlController.php +++ b/application/controllers/SqlController.php @@ -219,7 +219,6 @@ class SqlController extends Zend_Controller_Action } $this->view->dbCreated = $dbCreated; $this->view->errorInfo = $errorInfo; - } $this->view->newDbInfo = $newDbInfo; } diff --git a/tests/functional/controllers/SqlControllerTest.php b/tests/functional/controllers/SqlControllerTest.php index 4de8cf7..924722c 100644 --- a/tests/functional/controllers/SqlControllerTest.php +++ b/tests/functional/controllers/SqlControllerTest.php @@ -51,4 +51,25 @@ class Msd_Application_Controller_SqlControllerTest $expected = 'Datensätze der Tabelle `mysql`.`columns_priv`'; $this->assertQueryContentContains('h2', $expected); } + + public function testCanCreateADatabase() + { + $this->loginUser(); + //drop our testDb if it exists + $db = Msd_Db::getAdapter(); + $db->query('DROP DATABASE IF EXISTS `testDb`'); + $this->request->setMethod('POST'); + $newDbInfo = array( + 'dbName' => 'testDb', + 'dbCharset' => 'utf8', + 'dbCollation' => 'utf8_general_ci' + ); + $this->request->setPost('newDbInfo', $newDbInfo); + $this->dispatch('sql/create.database'); + $expected = 'Die Datenbank \'testDb\' wurde erfolgreich erstellt.'; + $this->assertQueryContentContains('div', $expected); + // clean up + $db->query('DROP DATABASE IF EXISTS `testDb`'); + } + } \ No newline at end of file diff --git a/tests/unit/library/Msd/LogTest.php b/tests/unit/library/Msd/LogTest.php index 1c48e17..3f375e0 100644 --- a/tests/unit/library/Msd/LogTest.php +++ b/tests/unit/library/Msd/LogTest.php @@ -61,11 +61,4 @@ class Msd_LogTest extends PHPUnit_Framework_TestCase } unset($logger); } - - public function testCanWriteToLogFile() - { - $res = Msd_Log::write(Msd_Log::PHP, 'test message'); - - print_r($res); - } } \ No newline at end of file