public function DeleteTruncateTest::testSpecialColumnDelete in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php \Drupal\KernelTests\Core\Database\DeleteTruncateTest::testSpecialColumnDelete()
Confirms that we can delete a single special column name record successfully.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ DeleteTruncateTest.php, line 142
Class
- DeleteTruncateTest
- Tests delete and truncate queries.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testSpecialColumnDelete() {
$num_records_before = $this->connection
->query('SELECT COUNT(*) FROM {select}')
->fetchField();
$num_deleted = $this->connection
->delete('select')
->condition('update', 'Update value 1')
->execute();
$this
->assertEquals(1, $num_deleted, 'Deleted 1 special column record.');
$num_records_after = $this->connection
->query('SELECT COUNT(*) FROM {select}')
->fetchField();
$this
->assertEquals($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
}