Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/tests/views_handlers.test | ||
---|---|---|
48 | 48 |
$empty_stdclass->value = array(); |
49 | 49 |
|
50 | 50 |
$null = NULL; |
51 |
// check defaults |
|
51 |
// check defaults.
|
|
52 | 52 |
$this->assertEqual($empty_stdclass, views_break_phrase_string('', $null)); |
53 | 53 |
|
54 | 54 |
$handler = views_get_handler('node', 'title', 'argument'); |
55 | 55 |
$this->assertEqual($handler, views_break_phrase_string('', $handler)); |
56 | 56 |
|
57 |
// test ors |
|
57 |
// test ors.
|
|
58 | 58 |
$handler = views_break_phrase_string('word1 word2+word'); |
59 | 59 |
$this->assertEqualValue(array('word1', 'word2', 'word'), $handler); |
60 | 60 |
$this->assertEqual('or', $handler->operator); |
... | ... | |
88 | 88 |
$this->assertEqualValue(array('wõrd1', 'wõrd2', 'wõrd'), $handler); |
89 | 89 |
$this->assertEqual('and', $handler->operator); |
90 | 90 |
|
91 |
// test a single word |
|
91 |
// test a single word.
|
|
92 | 92 |
$handler = views_break_phrase_string('word'); |
93 | 93 |
$this->assertEqualValue(array('word'), $handler); |
94 | 94 |
$this->assertEqual('and', $handler->operator); |
... | ... | |
103 | 103 |
$empty_stdclass->value = array(); |
104 | 104 |
|
105 | 105 |
$null = NULL; |
106 |
// check defaults |
|
106 |
// check defaults.
|
|
107 | 107 |
$this->assertEqual($empty_stdclass, views_break_phrase('', $null)); |
108 | 108 |
|
109 | 109 |
$handler = views_get_handler('node', 'title', 'argument'); |
... | ... | |
113 | 113 |
$n1 = rand(0, 100); |
114 | 114 |
$n2 = rand(0, 100); |
115 | 115 |
$n3 = rand(0, 100); |
116 |
// test ors |
|
116 |
// test ors.
|
|
117 | 117 |
$this->assertEqualValue(array($n1, $n2, $n3), views_break_phrase("$n1 $n2+$n3", $handler)); |
118 | 118 |
$this->assertEqual('or', $handler->operator); |
119 | 119 |
$this->assertEqualValue(array($n1, $n2, $n3), views_break_phrase("$n1+$n2+$n3", $handler)); |
... | ... | |
133 | 133 |
/** |
134 | 134 |
* Check to see if two values are equal. |
135 | 135 |
* |
136 |
* @param $first |
|
136 |
* @param string $first
|
|
137 | 137 |
* The first value to check. |
138 | 138 |
* @param views_handler $handler |
139 | 139 |
* @param string $message |
... | ... | |
147 | 147 |
protected function assertEqualValue($first, $handler, $message = '', $group = 'Other') { |
148 | 148 |
return $this->assert($first == $handler->value, $message ? $message : t('First value is equal to second value'), $group); |
149 | 149 |
} |
150 |
|
|
150 | 151 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules