Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseTransactionTestCase::assertRowPresent

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

Parameters

$name: The name of the row.

$message: The message to log for the assertion.

2 calls to DatabaseTransactionTestCase::assertRowPresent()
DatabaseTransactionTestCase::testTransactionStacking in modules/simpletest/tests/database_test.test
Test transaction stacking and commit / rollback.
DatabaseTransactionTestCase::testTransactionWithDdlStatement in modules/simpletest/tests/database_test.test
Test the compatibility of transactions with DDL statements.

File

modules/simpletest/tests/database_test.test, line 4064

Class

DatabaseTransactionTestCase
Test transaction support, particularly nesting.

Code

function assertRowPresent($name, $message = NULL) {
 if (!isset($message)) {
 $message = format_string ('Row %name is present.', array(
 '%name' => $name,
 ));
 }
 $present = (bool) db_query ('SELECT 1 FROM {test} WHERE name = :name', array(
 ':name' => $name,
 ))->fetchField ();
 return $this->assertTrue ($present, $message);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.