You are here

function ValueFieldTest::testValueFromFile_ in Realistic Dummy Content 8

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

File

api/tests/src/Unit/attributes/ValueFieldTest.php, line 24
Define autoload class.

Class

ValueFieldTest
Test Realistic dummy content.

Namespace

Drupal\Tests\realistic_dummy_content_api\Unit\attributes

Code

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