public function ContentLoaderTest::testPopulateFieldCardinalityZero in YAML Content 8
@covers ::populateField
File
- tests/
src/ Unit/ ContentLoader/ ContentLoaderTest.php, line 99
Class
- ContentLoaderTest
- Test generic functionality of the ContentLoader class.
Namespace
Drupal\Tests\yaml_content\Unit\ContentLoaderCode
public function testPopulateFieldCardinalityZero() {
$field_definition = new BaseFieldDefinition();
$field_definition
->setCardinality(0);
$field = new FieldItemList($field_definition, 'foobar');
$field_data = [];
$this
->expectException(\InvalidArgumentException::class);
$this
->expectExceptionMessage("'foobar' cannot hold any values.");
$this->contentLoader
->populateField($field, $field_data);
}