updated sequence driver test cases
This commit is contained in:
parent
609a228d5f
commit
c8d0a378dd
@ -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);
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user