Projet

Général

Profil

Paste
Télécharger (1,71 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / tests / styles / views_plugin_style_unformatted.test @ 4003efde

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of ViewsPluginStyleUnformattedTestCase.
6
 */
7

    
8
/**
9
 * Tests the default/unformatted row style.
10
 */
11
class ViewsPluginStyleUnformattedTestCase extends ViewsPluginStyleTestBase {
12

    
13
  public static function getInfo() {
14
    return array(
15
      'name' => 'Style: unformatted',
16
      'description' => 'Test unformatted style functionality.',
17
      'group' => 'Views Plugins',
18
    );
19
  }
20

    
21
  /**
22
   * Take sure that the default css classes works as expected.
23
   */
24
  function testDefaultRowClasses() {
25
    $view = $this->getBasicView();
26
    $rendered_output = $view->preview();
27
    $this->storeViewPreview($rendered_output);
28

    
29
    $rows = $this->elements->body->div->div->div;
30
    $count = 0;
31
    $count_result = count($view->result);
32
    foreach ($rows as $row) {
33
      $count++;
34
      $attributes = $row->attributes();
35
      $class = (string) $attributes['class'][0];
36
      // Take sure that each row has a row css class.
37
      $this->assertTrue(strpos($class, "views-row-$count") !== FALSE, 'Take sure that each row has a row css class.');
38
      // Take sure that the odd/even classes are set right.
39
      $odd_even = $count % 2 == 0 ? 'even' : 'odd';
40
      $this->assertTrue(strpos($class, "views-row-$odd_even") !== FALSE, 'Take sure that the odd/even classes are set right.');
41

    
42
      if ($count == 1) {
43
        $this->assertTrue(strpos($class, "views-row-first") !== FALSE, 'Take sure that the first class is set right.');
44
      }
45
      elseif ($count == $count_result) {
46
        $this->assertTrue(strpos($class, "views-row-last") !== FALSE, 'Take sure that the last class is set right.');
47

    
48
      }
49
      $this->assertTrue(strpos($class, 'views-row') !== FALSE, 'Take sure that the views row class is set right.');
50
    }
51
  }
52

    
53
}