RealisticDummyContentValueFieldTest.php in Realistic Dummy Content 8.2
File
api/src/test/includes/RealisticDummyContentValueFieldTest.php
View source
<?php
namespace Drupal\realistic_dummy_content_api\includes;
namespace Drupal\realistic_dummy_content_api\Test;
require_once './api/src/includes/RealisticDummyContentValueField.php';
class DummyFile {
private $value;
public function __construct($value) {
$this->value = $value;
}
public function value() {
return $this->value;
}
}
class RealisticDummyContentValueFieldTest extends \PHPUnit_Framework_TestCase {
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.');
}
}