Projet

Général

Profil

Révision 7e72b748

Ajouté par Assos Assos il y a plus de 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/tests/math_expression_stack.test
1 1
<?php
2 2

  
3
/**
4
 * @file
5
 * Contains \CtoolsMathExpressionStackTestCase
6
 */
7

  
8 3
/**
9 4
 * Tests the simple MathExpressionStack class.
10 5
 */
11 6
class CtoolsMathExpressionStackTestCase extends DrupalWebTestCase {
7

  
8
  /**
9
   * {@inheritDoc}
10
   */
12 11
  public static function getInfo() {
13 12
    return array(
14
      'name' => 'CTools math expression stack tests',
13
      'name' => 'Math expressions stack',
15 14
      'description' => 'Test the stack class of the math expression library.',
16 15
      'group' => 'ctools',
16
      'dependencies' => array('ctools'),
17 17
    );
18 18
  }
19 19

  
20
  public function setUp() {
21
    parent::setUp('ctools', 'ctools_plugin_test');
20
  /**
21
   * {@inheritDoc}
22
   */
23
  function setUp(array $modules = array()) {
24
    $modules[] = 'ctools';
25
    $modules[] = 'ctools_plugin_test';
26
    parent::setUp($modules);
22 27
  }
23 28

  
29
  /**
30
   * Test the math expression stack system.
31
   */
24 32
  public function testStack() {
25 33
    $stack = new ctools_math_expr_stack();
26 34

  
......
35 43
    $this->assertIdentical($value, $stack->pop());
36 44
    $this->assertNull($stack->pop());
37 45

  
38
    // Add multiple elements and see whether they are returned in the right order.
46
    // Add multiple elements and see whether they are returned in the right
47
    // order.
39 48
    $values = array($this->randomName(), $this->randomName(), $this->randomName());
40 49
    foreach ($values as $value) {
41 50
      $stack->push($value);
42 51
    }
43 52

  
44
    // Test the different elements at different positions with the last() method.
53
    // Test the different elements at different positions with the last()
54
    // method.
45 55
    $count = count($values);
46 56
    foreach ($values as $key => $value) {
47 57
      $this->assertEqual($value, $stack->last($count - $key));
......
58 68
      $this->assertEqual($stack->pop(), $value);
59 69
    }
60 70
    $this->assertNull($stack->pop());
61

  
62 71
  }
72

  
63 73
}

Formats disponibles : Unified diff