You are here

public function TransactionTest::setUp in Transaction 5

Initialize the test.

File

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

Class

TransactionTest
Implements the test cases for the transaction module.

Code

public function setUp() {
  parent::setUp();

  // Create a dummy table to test transactions on.
  db_query('DROP TABLE IF EXISTS {simpletest_transaction}');
  db_query('CREATE TABLE {simpletest_transaction} (
                  id int(10) UNSIGNED NOT NULL,
                  first_name varchar(32),
                  last_name varchar(32),
                  status tinyint(1) UNSIGNED NOT NULL,
                  PRIMARY KEY (id)
              ) /*!40100 DEFAULT CHARACTER SET UTF8 */');

  // Populate the dummy table with data.
  foreach (self::$test_data as $row) {
    $id = db_next_id('{simpletest_transaction}_id');
    db_query("INSERT INTO {simpletest_transaction}\n                    (id, first_name, last_name, status)\n                VALUES (%d, '%s', '%s', %d)", $id, $row[0], $row[1], $row[2]);
  }
}