diff --git a/tests/Sequence/MysqlTestCase.php b/tests/Sequence/MysqlTestCase.php index dfc2c7f47..08acb6ddf 100644 --- a/tests/Sequence/MysqlTestCase.php +++ b/tests/Sequence/MysqlTestCase.php @@ -30,13 +30,16 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Sequence_Mysql_TestCase extends Doctrine_UnitTestCase { - public function testCurrIdExecutesSql() { +class Doctrine_Sequence_Mysql_TestCase extends Doctrine_UnitTestCase +{ + public function testCurrIdExecutesSql() + { $this->sequence->currId('user'); $this->assertEqual($this->adapter->pop(), 'SELECT MAX(id) FROM user_seq'); } - public function testNextIdExecutesSql() { + public function testNextIdExecutesSql() + { $id = $this->sequence->nextId('user'); $this->assertEqual($id, 1); @@ -45,7 +48,8 @@ class Doctrine_Sequence_Mysql_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); $this->assertEqual($this->adapter->pop(), 'INSERT INTO user_seq (id) VALUES (NULL)'); } - public function testLastInsertIdCallsPdoLevelEquivalent() { + public function testLastInsertIdCallsPdoLevelEquivalent() + { $id = $this->sequence->lastInsertId('user'); $this->assertEqual($id, 1); diff --git a/tests/Sequence/OracleTestCase.php b/tests/Sequence/OracleTestCase.php index 120873358..8d12cc5a5 100644 --- a/tests/Sequence/OracleTestCase.php +++ b/tests/Sequence/OracleTestCase.php @@ -30,5 +30,26 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Sequence_Oracle_TestCase extends Doctrine_UnitTestCase { +class Doctrine_Sequence_Oracle_TestCase extends Doctrine_UnitTestCase +{ + public function testCurrIdExecutesSql() + { + $this->sequence->currId('user'); + $q = "SELECT (last_number-1) FROM user_sequences WHERE sequence_name='user_seq' OR sequence_name='USER_SEQ'"; + + $this->assertEqual($this->adapter->pop(), $q); + } + public function testNextIdExecutesSql() + { + $id = $this->sequence->nextId('user'); + + $this->assertEqual($this->adapter->pop(), 'SELECT user_seq.nextval FROM DUAL'); + + } + public function testLastInsertIdExecutesSql() + { + $this->sequence->lastInsertId('user'); + + $this->assertEqual($this->adapter->pop(), 'SELECT user_seq.currval'); + } } diff --git a/tests/Sequence/SqliteTestCase.php b/tests/Sequence/SqliteTestCase.php index 01a7c5cd6..b8c270dae 100644 --- a/tests/Sequence/SqliteTestCase.php +++ b/tests/Sequence/SqliteTestCase.php @@ -30,13 +30,16 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Sequence_Sqlite_TestCase extends Doctrine_UnitTestCase { - public function testCurrIdExecutesSql() { +class Doctrine_Sequence_Sqlite_TestCase extends Doctrine_UnitTestCase +{ + public function testCurrIdExecutesSql() + { $this->sequence->currId('user'); $this->assertEqual($this->adapter->pop(), 'SELECT MAX(id) FROM user_seq'); } - public function testNextIdExecutesSql() { + public function testNextIdExecutesSql() + { $id = $this->sequence->nextId('user'); $this->assertEqual($id, 1); @@ -45,7 +48,8 @@ class Doctrine_Sequence_Sqlite_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); $this->assertEqual($this->adapter->pop(), 'INSERT INTO user_seq (id) VALUES (NULL)'); } - public function testLastInsertIdCallsPdoLevelEquivalent() { + public function testLastInsertIdCallsPdoLevelEquivalent() + { $id = $this->sequence->lastInsertId('user'); $this->assertEqual($id, 1);