function FieldTest::testIsValueEmpty in Views (for Drupal 7) 8.3
Tests views_handler_field::is_value_empty().
File
- lib/
Drupal/ views/ Tests/ Handler/ FieldTest.php, line 948 - Definition of Drupal\views\Tests\Handler\FieldTest.
Class
- FieldTest
- Tests the generic field handler.
Namespace
Drupal\views\Tests\HandlerCode
function testIsValueEmpty() {
$view = $this
->getView();
$view
->initHandlers();
$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.');
}