You are here

public function PagerPluginBaseTest::testExecuteCountQueryWithoutOffset in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::testExecuteCountQueryWithoutOffset()

Tests the executeCountQuery method without a set offset.

See also

\Drupal\views\Plugin\views\pager\PagerPluginBase::executeCountQuery()

File

core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php, line 207
Contains \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest.

Class

PagerPluginBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\pager\PagerPluginBase @group views

Namespace

Drupal\Tests\views\Unit\Plugin\pager

Code

public function testExecuteCountQueryWithoutOffset() {
  $statement = $this
    ->getMock('\\Drupal\\Tests\\views\\Unit\\Plugin\\pager\\TestStatementInterface');
  $statement
    ->expects($this
    ->once())
    ->method('fetchField')
    ->will($this
    ->returnValue(3));
  $query = $this
    ->getMockBuilder('\\Drupal\\Core\\Database\\Query\\Select')
    ->disableOriginalConstructor()
    ->getMock();
  $query
    ->expects($this
    ->once())
    ->method('execute')
    ->will($this
    ->returnValue($statement));
  $this->pager
    ->setOffset(0);
  $this
    ->assertEquals(3, $this->pager
    ->executeCountQuery($query));
}