function CounterTest::testSimpleCounter
Tests a simple counter field.
@dataProvider providerRowIndexes
File
- 
              core/modules/ views/ tests/ src/ Unit/ Plugin/ field/ CounterTest.php, line 119 
Class
- CounterTest
- @coversDefaultClass \Drupal\views\Plugin\views\field\Counter[[api-linebreak]] @group views
Namespace
Drupal\Tests\views\Unit\Plugin\fieldCode
public function testSimpleCounter($i) : void {
  $counter_handler = new Counter([], 'counter', $this->definition);
  $options = [];
  $counter_handler->init($this->view, $this->display, $options);
  $this->view->row_index = $i;
  $expected = $i + 1;
  $counter = $counter_handler->getValue($this->testData[$i]);
  $this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
  $counter = $this->renderCounter($counter_handler, $this->testData[$i]);
  $this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
