function ViewsHandlerFieldTest::testIsValueEmpty
3.x views_handler_field.test | ViewsHandlerFieldTest::testIsValueEmpty() |
Tests views_handler_field::is_value_empty().
File
- tests/
handlers/ views_handler_field.test, line 294 - Definition of ViewsHandlerFieldTest.
Class
- ViewsHandlerFieldTest
- Tests the generic field handler
Code
function testIsValueEmpty() {
$view = $this->getBasicView();
$view->init_display();
$view->init_handlers();
$field = $view->field['name'];
$this->assertFalse($field->is_value_empty("not empty", TRUE), 'A normal string is not empty.');
$this->assertTrue($field->is_value_empty("not empty", TRUE, FALSE), 'A normal string which skips empty() can be seen as empty.');
$this->assertTrue($field->is_value_empty("", TRUE), '"" is considered as empty.');
$this->assertTrue($field->is_value_empty('0', TRUE), '"0" is considered as empty if empty_zero is TRUE.');
$this->assertTrue($field->is_value_empty(0, TRUE), '0 is considered as empty if empty_zero is TRUE.');
$this->assertFalse($field->is_value_empty('0', FALSE), '"0" is considered not as empty if empty_zero is FALSE.');
$this->assertFalse($field->is_value_empty(0, FALSE), '0 is considered not as empty if empty_zero is FALSE.');
$this->assertTrue($field->is_value_empty(NULL, TRUE, TRUE), 'Null should be always seen as empty, regardless of no_skip_empty.');
$this->assertTrue($field->is_value_empty(NULL, TRUE, FALSE), 'Null should be always seen as empty, regardless of no_skip_empty.');
}