function SqlBaseTest::setUp

Same name in this branch
  1. 10 core/modules/migrate/tests/src/Kernel/SqlBaseTest.php \Drupal\Tests\migrate\Kernel\SqlBaseTest::setUp()
Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\SqlBaseTest::setUp()
  2. 9 core/modules/migrate/tests/src/Kernel/SqlBaseTest.php \Drupal\Tests\migrate\Kernel\SqlBaseTest::setUp()
  3. 8.9.x core/modules/migrate/tests/src/Kernel/SqlBaseTest.php \Drupal\Tests\migrate\Kernel\SqlBaseTest::setUp()
  4. 11.x core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php \Drupal\Tests\views\Unit\Plugin\pager\SqlBaseTest::setUp()
  5. 11.x core/modules/migrate/tests/src/Kernel/SqlBaseTest.php \Drupal\Tests\migrate\Kernel\SqlBaseTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php, line 39

Class

SqlBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\pager\SqlBase @group views

Namespace

Drupal\Tests\views\Unit\Plugin\pager

Code

protected function setUp() : void {
    parent::setUp();
    $this->pager = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\pager\\SqlBase')
        ->disableOriginalConstructor()
        ->getMockForAbstractClass();
    
    /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
    $this->view = $this->getMockBuilder('Drupal\\views\\ViewExecutable')
        ->disableOriginalConstructor()
        ->getMock();
    $query = $this->getMockBuilder(QueryPluginBase::class)
        ->disableOriginalConstructor()
        ->getMock();
    $this->view->query = $query;
    $this->display = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
        ->disableOriginalConstructor()
        ->getMock();
    $container = new ContainerBuilder();
    $container->set('string_translation', $this->getStringTranslationStub());
    \Drupal::setContainer($container);
}

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