1
0
mirror of synced 2025-01-18 22:41:43 +03:00

updated sequence driver test cases

This commit is contained in:
zYne 2007-01-08 00:12:29 +00:00
parent 609a228d5f
commit c8d0a378dd
3 changed files with 38 additions and 9 deletions

View File

@ -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);

View File

@ -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');
}
}

View File

@ -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);