You are here

function DeleteTruncateTest::testSpecialColumnDelete in Zircon Profile 8

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

Confirms that we can delete a single special column name record successfully.

File

core/modules/system/src/Tests/Database/DeleteTruncateTest.php, line 77
Contains \Drupal\system\Tests\Database\DeleteTruncateTest.

Class

DeleteTruncateTest
Tests delete and truncate queries.

Namespace

Drupal\system\Tests\Database

Code

function testSpecialColumnDelete() {
  $num_records_before = db_query('SELECT COUNT(*) FROM {test_special_columns}')
    ->fetchField();
  $num_deleted = db_delete('test_special_columns')
    ->condition('id', 1)
    ->execute();
  $this
    ->assertIdentical($num_deleted, 1, 'Deleted 1 special column record.');
  $num_records_after = db_query('SELECT COUNT(*) FROM {test_special_columns}')
    ->fetchField();
  $this
    ->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
}