From 0e990f75947ef72e6bcf25b23b306fad5f97258f Mon Sep 17 00:00:00 2001 From: njero Date: Wed, 1 Aug 2007 16:43:44 +0000 Subject: [PATCH] Add test case for single field index as string --- tests/Export/MysqlTestCase.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Export/MysqlTestCase.php b/tests/Export/MysqlTestCase.php index 327c0d287..5583bf959 100644 --- a/tests/Export/MysqlTestCase.php +++ b/tests/Export/MysqlTestCase.php @@ -246,6 +246,20 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase $this->assertEqual($this->export->getIndexFieldDeclarationList($fields), 'id(10) ASC, name(1) DESC'); } + public function testCreateTableSupportsIndexesUsingSingleFieldString() + { + $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), + 'name' => array('type' => 'string', 'length' => 4), + ); + + $options = array('primary' => array('id'), + 'indexes' => array('myindex' => array( + 'fields' => 'name')) + ); + + $this->export->createTable('sometable', $fields, $options); + $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4), INDEX myindex_idx (name), PRIMARY KEY(id)) ENGINE = INNODB'); + } public function testCreateTableSupportsIndexesWithCustomSorting() { $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true),