You are here

public function TransactionTest::testTransactionDBNextID in Transaction 5

Verify the operation of transaction_db_next_id().

File

tests/transaction.test, line 91
Contains the test for the transaction module (formerly pressflow_transaction).

Class

TransactionTest
Implements the test cases for the transaction module.

Code

public function testTransactionDBNextID() {

  // First check that it works correctly on the sequence created in setUp().
  $current = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", db_prefix_tables(self::$sequence1)));
  $test = transaction_db_next_id(self::$sequence1);
  $msg = t('Next ID on existing sequence : %s');
  $this
    ->assertEqual($test, $current + 1, $msg);

  // Now create a new sequence and verify it was created.
  $second = transaction_db_next_id(self::$sequence2);
  $test = db_next_id(self::$sequence2);
  $msg = t('Next ID on new sequence : %s');
  $this
    ->assertEqual($test, 2, $msg);
}