function DriverSpecificTransactionTestBase::assertRowAbsent

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php \Drupal\KernelTests\Core\Database\DriverSpecificTransactionTestBase::assertRowAbsent()

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

@internal

Parameters

string $name: The name of the row.

string $message: The message to log for the assertion.

8 calls to DriverSpecificTransactionTestBase::assertRowAbsent()
DriverSpecificTransactionTestBase::testRollbackRoot in core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
Tests root transaction rollback.
DriverSpecificTransactionTestBase::testRollbackRootAfterSavepointRollback in core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
Tests root transaction rollback after savepoint rollback.
DriverSpecificTransactionTestBase::testRollbackSavepoint in core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
Tests savepoint transaction rollback.
DriverSpecificTransactionTestBase::testRollbackTwiceSameSavepoint in core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
Tests savepoint transaction duplicated rollback.
DriverSpecificTransactionTestBase::testRootTransactionEndCallbackCalledAfterDdlAndDestruction in core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
Tests post-transaction callback executes after a DDL statement.

... See full list

File

core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php, line 510

Class

DriverSpecificTransactionTestBase
Tests the transaction abstraction system.

Namespace

Drupal\KernelTests\Core\Database

Code

public function assertRowAbsent(string $name, ?string $message = NULL) : void {
    $present = (bool) $this->connection
        ->query('SELECT 1 FROM {test} WHERE [name] = :name', [
        ':name' => $name,
    ])
        ->fetchField();
    $this->assertFalse($present, $message ?? "Row '{$name}' should be absent, but it actually exists.");
}

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