StyleUnformattedTest.php 1.18 KB
Newer Older
merlinofchaos's avatar
merlinofchaos committed
1
2
3
4
<?php

/**
 * @file
5
 * Definition of Drupal\views\Tests\Plugin\StyleUnformattedTest.
merlinofchaos's avatar
merlinofchaos committed
6
7
 */

8
namespace Drupal\views\Tests\Plugin;
9

10
11
use Drupal\views\Views;

merlinofchaos's avatar
merlinofchaos committed
12
13
14
/**
 * Tests the default/unformatted row style.
 */
15
class StyleUnformattedTest extends StyleTestBase {
merlinofchaos's avatar
merlinofchaos committed
16

17
18
19
20
21
22
23
  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = array('test_view');

merlinofchaos's avatar
merlinofchaos committed
24
25
  public static function getInfo() {
    return array(
26
      'name' => 'Style: Unformatted',
merlinofchaos's avatar
merlinofchaos committed
27
28
29
30
31
32
      'description' => 'Test unformatted style functionality.',
      'group' => 'Views Plugins',
    );
  }

  /**
33
   * Make sure that the default css classes works as expected.
merlinofchaos's avatar
merlinofchaos committed
34
35
   */
  function testDefaultRowClasses() {
36
    $view = Views::getView('test_view');
37
    $view->setDisplay();
38
39
    $output = $view->preview();
    $this->storeViewPreview(drupal_render($output));
merlinofchaos's avatar
merlinofchaos committed
40
41
42
43
44
45
46
47

    $rows = $this->elements->body->div->div->div;
    $count = 0;
    $count_result = count($view->result);
    foreach ($rows as $row) {
      $count++;
      $attributes = $row->attributes();
      $class = (string) $attributes['class'][0];
48
      $this->assertTrue(strpos($class, 'views-row') !== FALSE, 'Make sure that the views row class is set right.');
merlinofchaos's avatar
merlinofchaos committed
49
50
51
52
    }
  }

}