From b3770974f148435a24f7f33e9a926154304f22e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 16 Oct 2014 16:44:09 +0200 Subject: [PATCH] Added tests for MySQL table comment feature --- .../Test/Case/Model/Datasource/Database/MysqlTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index e1a7c2af1..3861ec221 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -704,7 +704,8 @@ class MysqlTest extends CakeTestCase { 'tableParameters' => array( 'charset' => 'utf8', 'collate' => 'utf8_general_ci', - 'engine' => 'InnoDB' + 'engine' => 'InnoDB', + 'comment' => 'Newly table added comment.', ) ) )); @@ -712,6 +713,7 @@ class MysqlTest extends CakeTestCase { $this->assertContains('DEFAULT CHARSET=utf8', $result); $this->assertContains('ENGINE=InnoDB', $result); $this->assertContains('COLLATE=utf8_general_ci', $result); + $this->assertContains('COMMENT=\'Newly table added comment.\'', $result); $this->Dbo->rawQuery($result); $result = $this->Dbo->listDetailedSources($this->Dbo->fullTableName('altertest', false, false)); @@ -775,13 +777,15 @@ class MysqlTest extends CakeTestCase { $this->assertEquals($expected, $result); $table = $this->Dbo->fullTableName($tableName); - $this->Dbo->rawQuery('CREATE TABLE ' . $table . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_ci;'); + $this->Dbo->rawQuery('CREATE TABLE ' . $table . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_ci COMMENT=\'Table\'\'s comment\';'); $result = $this->Dbo->readTableParameters($this->Dbo->fullTableName($tableName, false, false)); $this->Dbo->rawQuery('DROP TABLE ' . $table); $expected = array( 'charset' => 'cp1250', 'collate' => 'cp1250_general_ci', - 'engine' => 'MyISAM'); + 'engine' => 'MyISAM', + 'comment' => 'Table\'s comment', + ); $this->assertEquals($expected, $result); }