Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/tests/handlers/views_handler_field.test | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Tests the generic field handler |
|
9 |
* Tests the generic field handler.
|
|
10 | 10 |
* |
11 | 11 |
* @see views_handler_field |
12 | 12 |
*/ |
13 | 13 |
class ViewsHandlerFieldTest extends ViewsSqlTest { |
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
*/ |
|
14 | 18 |
public static function getInfo() { |
15 | 19 |
return array( |
16 | 20 |
'name' => 'Field', |
... | ... | |
19 | 23 |
); |
20 | 24 |
} |
21 | 25 |
|
26 |
/** |
|
27 |
* |
|
28 |
*/ |
|
22 | 29 |
protected function setUp() { |
23 | 30 |
parent::setUp(); |
24 | 31 |
$this->column_map = array( |
... | ... | |
26 | 33 |
); |
27 | 34 |
} |
28 | 35 |
|
29 |
function testEmpty() { |
|
30 |
$this->_testHideIfEmpty(); |
|
31 |
$this->_testEmptyText(); |
|
32 |
} |
|
33 |
|
|
34 | 36 |
/** |
35 | 37 |
* Tests the hide if empty functionality. |
36 | 38 |
* |
37 | 39 |
* This tests alters the result to get easier and less coupled results. |
38 | 40 |
*/ |
39 |
function _testHideIfEmpty() {
|
|
41 |
public function testHideIfEmpty() {
|
|
40 | 42 |
$view = $this->getBasicView(); |
41 | 43 |
$view->init_display(); |
42 | 44 |
$this->executeView($view); |
... | ... | |
139 | 141 |
$render = $view->field['name']->advanced_render($view->result[0]); |
140 | 142 |
$this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, "0" should not be treated as empty.'); |
141 | 143 |
|
142 |
// Test when results are rewritten to an empty string and non-zero empty results are hidden. |
|
144 |
// Test when results are rewritten to an empty string and non-zero empty |
|
145 |
// results are hidden. |
|
143 | 146 |
$view->field['name']->options['hide_alter_empty'] = TRUE; |
144 | 147 |
$view->field['name']->options['hide_empty'] = TRUE; |
145 | 148 |
$view->field['name']->options['empty_zero'] = FALSE; |
... | ... | |
254 | 257 |
/** |
255 | 258 |
* Tests the usage of the empty text. |
256 | 259 |
*/ |
257 |
function _testEmptyText() {
|
|
260 |
public function testEmptyText() {
|
|
258 | 261 |
$view = $this->getBasicView(); |
259 | 262 |
$view->init_display(); |
260 | 263 |
$this->executeView($view); |
... | ... | |
291 | 294 |
/** |
292 | 295 |
* Tests views_handler_field::is_value_empty(). |
293 | 296 |
*/ |
294 |
function testIsValueEmpty() { |
|
297 |
public function testIsValueEmpty() {
|
|
295 | 298 |
$view = $this->getBasicView(); |
296 | 299 |
$view->init_display(); |
297 | 300 |
$view->init_handlers(); |
Formats disponibles : Unified diff
Weekly update of contrib modules