You are here

protected function CounterTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php \Drupal\Tests\views\Unit\Plugin\field\CounterTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php, line 61
Contains \Drupal\Tests\views\Unit\Plugin\field\CounterTest.

Class

CounterTest
@coversDefaultClass \Drupal\views\Plugin\views\field\Counter @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

protected function setUp() {
  parent::setUp();

  // Setup basic stuff like the view and the display.
  $config = array();
  $config['display']['default'] = array(
    'id' => 'default',
    'display_plugin' => 'default',
    'display_title' => 'Default',
  );
  $storage = new View($config, 'view');
  $user = $this
    ->getMock('Drupal\\Core\\Session\\AccountInterface');
  $views_data = $this
    ->getMockBuilder('Drupal\\views\\ViewsData')
    ->disableOriginalConstructor()
    ->getMock();
  $route_provider = $this
    ->getMock('Drupal\\Core\\Routing\\RouteProviderInterface');
  $this->view = $this
    ->getMock('Drupal\\views\\ViewExecutable', NULL, array(
    $storage,
    $user,
    $views_data,
    $route_provider,
  ));
  $this->display = $this
    ->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
    ->disableOriginalConstructor()
    ->getMock();
  $this->pager = $this
    ->getMockBuilder('Drupal\\views\\Plugin\\views\\pager\\Full')
    ->disableOriginalConstructor()
    ->setMethods(NULL)
    ->getMock();
  $this->view->display_handler = $this->display;
  $this->view->pager = $this->pager;
  foreach (ViewTestData::dataSet() as $index => $set) {
    $this->testData[] = new ResultRow($set + [
      'index' => $index,
    ]);
  }
  $this->definition = array(
    'title' => 'counter field',
    'plugin_type' => 'field',
  );
}