You are here

function TransactionTest::assertRowAbsent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/TransactionTest.php \Drupal\system\Tests\Database\TransactionTest::assertRowAbsent()

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

Parameters

$name: The name of the row.

$message: The message to log for the assertion.

2 calls to TransactionTest::assertRowAbsent()
TransactionTest::testTransactionStacking in core/modules/system/src/Tests/Database/TransactionTest.php
Tests transaction stacking, commit, and rollback.
TransactionTest::testTransactionWithDdlStatement in core/modules/system/src/Tests/Database/TransactionTest.php
Tests the compatibility of transactions with DDL statements.

File

core/modules/system/src/Tests/Database/TransactionTest.php, line 375
Contains \Drupal\system\Tests\Database\TransactionTest.

Class

TransactionTest
Tests the transaction abstraction system.

Namespace

Drupal\system\Tests\Database

Code

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