Drupal 8  8.0.2
TransactionTest Class Reference
Inheritance diagram for TransactionTest:

Public Member Functions

 testTransactionRollBackSupported ()
 
 testTransactionRollBackNotSupported ()
 
 testCommittedTransaction ()
 
 testTransactionWithDdlStatement ()
 
 assertRowPresent ($name, $message=NULL)
 
 assertRowAbsent ($name, $message=NULL)
 
 testTransactionStacking ()
 
- Public Member Functions inherited from DatabaseTestBase
 ensureSampleDataNull ()
 

Protected Member Functions

 transactionOuterLayer ($suffix, $rollback=FALSE, $ddl_statement=FALSE)
 
 transactionInnerLayer ($suffix, $rollback=FALSE, $ddl_statement=FALSE)
 
 insertRow ($name)
 
 executeDDLStatement ()
 
 cleanUp ()
 
- Protected Member Functions inherited from DatabaseTestBase
 setUp ()
 

Additional Inherited Members

- Static Public Member Functions inherited from DatabaseTestBase
static addSampleData ()
 
- Static Public Attributes inherited from DatabaseTestBase
static $modules = array('database_test')
 

Detailed Description

Tests the transaction abstraction system.

We test nesting by having two transaction layers, an outer and inner. The outer layer encapsulates the inner layer. Our transaction nesting abstraction should allow the outer layer function to call any function it wants, especially the inner layer that starts its own transaction, and be confident that, when the function it calls returns, its own transaction is still "alive."

Call structure: transactionOuterLayer() Start transaction transactionInnerLayer() Start transaction (does nothing in database) [Maybe decide to roll back] Do more stuff Should still be in transaction A

Database

Member Function Documentation

assertRowAbsent (   $name,
  $message = NULL 
)

Asserts that a given row is absent from the test table.

Parameters
$nameThe name of the row.
$messageThe message to log for the assertion.

References db_query(), and format_string().

Referenced by TransactionTest\testTransactionStacking(), and TransactionTest\testTransactionWithDdlStatement().

Here is the call graph for this function:

Here is the caller graph for this function:

assertRowPresent (   $name,
  $message = NULL 
)

Asserts that a given row is present in the test table.

Parameters
$nameThe name of the row.
$messageThe message to log for the assertion.

References db_query(), and format_string().

Referenced by TransactionTest\testTransactionStacking(), and TransactionTest\testTransactionWithDdlStatement().

Here is the call graph for this function:

Here is the caller graph for this function:

cleanUp ( )
protected

Starts over for a new test.

References db_truncate().

Referenced by TransactionTest\testTransactionStacking(), and TransactionTest\testTransactionWithDdlStatement().

Here is the call graph for this function:

Here is the caller graph for this function:

executeDDLStatement ( )
protected

Executes a DDL statement.

References db_create_table().

Referenced by TransactionTest\testTransactionWithDdlStatement().

Here is the call graph for this function:

Here is the caller graph for this function:

insertRow (   $name)
protected

Inserts a single row into the testing table.

References db_insert().

Referenced by TransactionTest\testTransactionStacking(), and TransactionTest\testTransactionWithDdlStatement().

Here is the call graph for this function:

Here is the caller graph for this function:

testCommittedTransaction ( )

Tests a committed transaction.

The behavior of this test should be identical for connections that support transactions and those that do not.

References db_query(), and TransactionTest\transactionOuterLayer().

Here is the call graph for this function:

testTransactionRollBackNotSupported ( )

Tests transaction rollback on a database that doesn't support transactions.

If the active driver supports transactions, this test does nothing.

References db_query(), Database\getConnection(), and TransactionTest\transactionOuterLayer().

Here is the call graph for this function:

testTransactionRollBackSupported ( )

Tests transaction rollback on a database that supports transactions.

If the active connection does not support transactions, this test does nothing.

References db_query(), Database\getConnection(), and TransactionTest\transactionOuterLayer().

Here is the call graph for this function:

testTransactionStacking ( )

Tests transaction stacking, commit, and rollback.

References TransactionTest\assertRowAbsent(), TransactionTest\assertRowPresent(), TransactionTest\cleanUp(), db_transaction(), Database\getConnection(), and TransactionTest\insertRow().

Here is the call graph for this function:

testTransactionWithDdlStatement ( )

Tests the compatibility of transactions with DDL statements.

References TransactionTest\assertRowAbsent(), TransactionTest\assertRowPresent(), TransactionTest\cleanUp(), db_transaction(), TransactionTest\executeDDLStatement(), Database\getConnection(), and TransactionTest\insertRow().

Here is the call graph for this function:

transactionInnerLayer (   $suffix,
  $rollback = FALSE,
  $ddl_statement = FALSE 
)
protected

Creates an "inner layer" transaction.

This "inner layer" transaction is either used alone or nested inside of the "outer layer" transaction.

Parameters
$suffixSuffix to add to field values to differentiate tests.
$rollbackWhether or not to try rolling back the transaction when we're done.
$ddl_statementWhether to execute a DDL statement during the transaction.

References db_create_table(), db_insert(), db_transaction(), and Database\getConnection().

Referenced by TransactionTest\transactionOuterLayer().

Here is the call graph for this function:

Here is the caller graph for this function:

transactionOuterLayer (   $suffix,
  $rollback = FALSE,
  $ddl_statement = FALSE 
)
protected

Encapsulates a transaction's "inner layer" with an "outer layer".

This "outer layer" transaction starts and then encapsulates the "inner layer" transaction. This nesting is used to evaluate whether the database transaction API properly supports nesting. By "properly supports," we mean the outer transaction continues to exist regardless of what functions are called and whether those functions start their own transactions.

In contrast, a typical database would commit the outer transaction, start a new transaction for the inner layer, commit the inner layer transaction, and then be confused when the outer layer transaction tries to commit its transaction (which was already committed when the inner transaction started).

Parameters
$suffixSuffix to add to field values to differentiate tests.
$rollbackWhether or not to try rolling back the transaction when we're done.
$ddl_statementWhether to execute a DDL statement during the inner transaction.

References db_insert(), db_transaction(), Database\getConnection(), and TransactionTest\transactionInnerLayer().

Referenced by TransactionTest\testCommittedTransaction(), TransactionTest\testTransactionRollBackNotSupported(), and TransactionTest\testTransactionRollBackSupported().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: