Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / views / tests / src / Kernel / Plugin / StyleUnformattedTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Kernel\Plugin;
4
5 use Drupal\views\Views;
6
7 /**
8  * Tests unformatted style functionality.
9  *
10  * @group views
11  */
12 class StyleUnformattedTest extends StyleTestBase {
13
14   /**
15    * Views used by this test.
16    *
17    * @var array
18    */
19   public static $testViews = ['test_view'];
20
21   /**
22    * Make sure that the default css classes works as expected.
23    */
24   public function testDefaultRowClasses() {
25     $view = Views::getView('test_view');
26     $view->setDisplay();
27     $output = $view->preview();
28     $this->storeViewPreview(\Drupal::service('renderer')->renderRoot($output));
29
30     $rows = $this->elements->body->div->div;
31     $count = 0;
32     $count_result = count($view->result);
33     foreach ($rows as $row) {
34       $count++;
35       $attributes = $row->attributes();
36       $class = (string) $attributes['class'][0];
37       $this->assertTrue(strpos($class, 'views-row') !== FALSE, 'Make sure that the views row class is set right.');
38     }
39     $this->assertIdentical($count, $count_result);
40   }
41
42 }