You are here

function AlterTest::testSimpleAlter in Zircon Profile 8

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

Tests that we can do basic alters.

File

core/modules/system/src/Tests/Database/AlterTest.php, line 21
Contains \Drupal\system\Tests\Database\AlterTest.

Class

AlterTest
Tests the hook_query_alter capabilities of the Select builder.

Namespace

Drupal\system\Tests\Database

Code

function testSimpleAlter() {
  $query = db_select('test');
  $query
    ->addField('test', 'name');
  $query
    ->addField('test', 'age', 'age');
  $query
    ->addTag('database_test_alter_add_range');
  $result = $query
    ->execute()
    ->fetchAll();
  $this
    ->assertEqual(count($result), 2, 'Returned the correct number of rows.');
}