Loading core/lib/Drupal/Core/Database/Query/Select.php +1 −1 Changes for core/lib/Drupal/Core/Database/Query/Select.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -660,7 +660,7 @@ public function orderRandom() { * {@inheritdoc} */ public function range($start = NULL, $length = NULL) { $this->range = func_num_args() ? array('start' => $start, 'length' => $length) : array(); $this->range = $start !== NULL ? array('start' => $start, 'length' => $length) : array(); return $this; } Loading core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php +14 −0 Changes for core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -154,6 +154,20 @@ function testRange() { $this->assertEqual($query_result, 2, 'Returned the correct number of rows.'); } /** * Test whether the range property of a select clause can be undone. */ function testRangeUndo() { $query = db_select('test'); $name_field = $query->addField('test', 'name'); $age_field = $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.'); } /** * Tests distinct queries. */ Loading Loading
core/lib/Drupal/Core/Database/Query/Select.php +1 −1 Changes for core/lib/Drupal/Core/Database/Query/Select.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -660,7 +660,7 @@ public function orderRandom() { * {@inheritdoc} */ public function range($start = NULL, $length = NULL) { $this->range = func_num_args() ? array('start' => $start, 'length' => $length) : array(); $this->range = $start !== NULL ? array('start' => $start, 'length' => $length) : array(); return $this; } Loading
core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php +14 −0 Changes for core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -154,6 +154,20 @@ function testRange() { $this->assertEqual($query_result, 2, 'Returned the correct number of rows.'); } /** * Test whether the range property of a select clause can be undone. */ function testRangeUndo() { $query = db_select('test'); $name_field = $query->addField('test', 'name'); $age_field = $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.'); } /** * Tests distinct queries. */ Loading