function StyleUnformattedTest::testDefaultRowClasses
Same name in other branches
- 8.9.x core/modules/views/tests/src/Kernel/Plugin/StyleUnformattedTest.php \Drupal\Tests\views\Kernel\Plugin\StyleUnformattedTest::testDefaultRowClasses()
- 10 core/modules/views/tests/src/Kernel/Plugin/StyleUnformattedTest.php \Drupal\Tests\views\Kernel\Plugin\StyleUnformattedTest::testDefaultRowClasses()
- 11.x core/modules/views/tests/src/Kernel/Plugin/StyleUnformattedTest.php \Drupal\Tests\views\Kernel\Plugin\StyleUnformattedTest::testDefaultRowClasses()
Make sure that the default css classes works as expected.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Plugin/ StyleUnformattedTest.php, line 24
Class
- StyleUnformattedTest
- Tests unformatted style functionality.
Namespace
Drupal\Tests\views\Kernel\PluginCode
public function testDefaultRowClasses() {
$view = Views::getView('test_view');
$view->setDisplay();
$output = $view->preview();
$this->storeViewPreview(\Drupal::service('renderer')->renderRoot($output));
$rows = $this->elements->body->div->div;
$count = 0;
$count_result = count($view->result);
foreach ($rows as $row) {
$count++;
$attributes = $row->attributes();
$class = (string) $attributes['class'][0];
$this->assertStringContainsString('views-row', $class, 'Make sure that the views row class is set right.');
}
$this->assertSame($count, $count_result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.