function TransactionTest::assertRowPresent
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php \Drupal\KernelTests\Core\Database\TransactionTest::assertRowPresent()
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php \Drupal\KernelTests\Core\Database\TransactionTest::assertRowPresent()
Asserts that a given row is present in the test table.
@internal
Parameters
string $name: The name of the row.
string $message: The message to log for the assertion.
19 calls to TransactionTest::assertRowPresent()
- TransactionTest::createFirstSavepointTransaction in core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php - Create a Drupal savepoint transaction after root.
- TransactionTest::createRootTransaction in core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php - Create a root Drupal transaction.
- TransactionTest::testCommitAfterDdl in core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php - Tests commit does not fail when committing after DDL.
- TransactionTest::testCommitAfterRollbackSameSavepoint in core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php - Tests savepoint transaction commit after rollback.
- TransactionTest::testCommitWithActiveSavepoint in core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php - Tests committing a transaction while savepoints are active.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php, line 744
Class
- TransactionTest
- Tests the transactions, using the explicit ::commitOrRelease method.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function assertRowPresent(string $name, ?string $message = NULL) : void {
$present = (bool) $this->connection
->query('SELECT 1 FROM {test} WHERE [name] = :name', [
':name' => $name,
])
->fetchField();
$this->assertTrue($present, $message ?? "Row '{$name}' should be present, but it actually does not exist.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.