function PagerPluginBaseTest::testExecuteCountQueryWithoutOffset

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::testExecuteCountQueryWithoutOffset()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\PagerPluginBaseTest::testExecuteCountQueryWithoutOffset()
  3. 11.x 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 210

Class

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

Namespace

Drupal\Tests\views\Unit\Plugin\pager

Code

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

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