You are here

public function RealisticDummyContentValueFieldTest::testEmpty in Realistic Dummy Content 8.2

Same name and namespace in other branches
  1. 7.2 api/src/test/includes/RealisticDummyContentValueFieldTest.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentValueFieldTest::testEmpty()

Test that empty files and non-existing files are treated differently.

File

api/src/test/includes/RealisticDummyContentValueFieldTest.php, line 47

Class

RealisticDummyContentValueFieldTest
Tests for ...\includes\RealisticDummyContentValueField.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function testEmpty() {
  $field = new RealisticDummyContentValueField('ignore entity', 'ignore name');
  $null = new DummyFile(NULL);
  $empty = new DummyFile('');
  $this
    ->assertFalse(is_array($field
    ->implementValueFromFile($null)), 'No applicable field value is represented by NULL.');
  $this
    ->assertTrue(is_array($field
    ->implementValueFromFile($empty)), 'An empty string is considered a valid value.');
}