diff --git a/tests/ExportMysqlTestCase.php b/tests/ExportMysqlTestCase.php index 5de81411a..d08917245 100644 --- a/tests/ExportMysqlTestCase.php +++ b/tests/ExportMysqlTestCase.php @@ -1,7 +1,60 @@ export->createDatabase('db'); + + $this->assertEqual($this->adapter->pop(), 'CREATE DATABASE db'); + } + public function testDropDatabaseExecutesSql() { + $this->export->dropDatabase('db'); + + $this->assertEqual($this->adapter->pop(), 'DROP DATABASE db'); + } + public function testAlterTableThrowsExceptionWithoutValidTableName() { + try { + $this->export->alterTable(0,0,array()); + + $this->fail(); + } catch(Doctrine_Export_Exception $e) { + $this->pass(); + } + } + public function testCreateTableThrowsExceptionWithoutValidTableName() { + try { + $this->export->createTable(0,array(),array()); + + $this->fail(); + } catch(Doctrine_Export_Exception $e) { + $this->pass(); + } + } + public function testCreateTableThrowsExceptionWithEmptyFieldsArray() { + try { + $this->export->createTable('sometable',array(),array()); + + $this->fail(); + } catch(Doctrine_Export_Exception $e) { + $this->pass(); + } + } + public function testCreateIndexExecutesSql() { + $this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array()))); + + $this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy ON sometable (title, content)'); + } + + public function testDropIndexExecutesSql() { + $this->export->dropIndex('sometable', 'relevancy'); + + $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy ON sometable'); + } + public function testDropTableExecutesSql() { + $this->export->dropTable('sometable'); + + $this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable'); } } ?> diff --git a/tests/QueryLimitTestCase.php b/tests/QueryLimitTestCase.php index 7ffa0652a..044ce5d27 100644 --- a/tests/QueryLimitTestCase.php +++ b/tests/QueryLimitTestCase.php @@ -217,6 +217,11 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase { $this->manager->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_RECORDS); } + public function testLimitWithManyToManyAndColumnAggregationInheritance() { + $q = new Doctrine_Query(); + $q->from('User u, u.Group g')->where('g.id > 1')->orderby('u.name DESC')->limit(10); + + } public function testLimitWithNormalManyToMany() { $coll = new Doctrine_Collection($this->connection->getTable("Photo")); $tag = new Tag(); @@ -237,7 +242,8 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase { $photos = $q->execute(array(1)); $this->assertEqual($photos->count(), 3); $this->assertEqual($q->getQuery(), - "SELECT p.id AS p__id, p.name AS p__name FROM photo p LEFT JOIN phototag ON p.id = phototag.photo_id LEFT JOIN tag t ON t.id = phototag.tag_id WHERE p.id IN (SELECT DISTINCT p2.id FROM photo p2 LEFT JOIN phototag ON p2.id = phototag.photo_id LEFT JOIN tag t2 ON t2.id = phototag.tag_id WHERE t2.id = ? ORDER BY p2.id DESC LIMIT 100) AND t2.id = ? ORDER BY p.id DESC"); + "SELECT p.id AS p__id, p.name AS p__name FROM photo p LEFT JOIN phototag ON p.id = phototag.photo_id LEFT JOIN tag t ON t.id = phototag.tag_id WHERE p.id IN (SELECT DISTINCT p2.id FROM photo p2 LEFT JOIN phototag ON p2.id = phototag.photo_id LEFT JOIN tag t2 ON t2.id = phototag.tag_id WHERE t2.id = ? ORDER BY p2.id DESC LIMIT 100) AND t.id = ? ORDER BY p.id DESC"); + } }