function SelectComplexTest::testRangeUndo

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRangeUndo()
  2. 10 core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRangeUndo()
  3. 11.x core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php \Drupal\KernelTests\Core\Database\SelectComplexTest::testRangeUndo()

Test whether the range property of a select clause can be undone.

File

core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php, line 162

Class

SelectComplexTest
Tests the Select query builder with more complex queries.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testRangeUndo() {
    $query = $this->connection
        ->select('test');
    $query->addField('test', 'name');
    $query->addField('test', 'age', 'age');
    $query->range(0, 2);
    $query->range(NULL, NULL);
    $query_result = $query->countQuery()
        ->execute()
        ->fetchField();
    $this->assertEqual($query_result, 4, 'Returned the correct number of rows.');
}

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