function BaseFieldDefinitionTest::testFieldCardinality
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldCardinality()
- 10 core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldCardinality()
- 11.x core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldCardinality()
Tests field cardinality.
@covers ::getCardinality @covers ::setCardinality
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ BaseFieldDefinitionTest.php, line 282
Class
- BaseFieldDefinitionTest
- Unit test for BaseFieldDefinition.
Namespace
Drupal\Tests\Core\EntityCode
public function testFieldCardinality() {
$definition = BaseFieldDefinition::create($this->fieldType);
$this->assertEquals(1, $definition->getCardinality());
$definition->setCardinality(2);
$this->assertEquals(2, $definition->getCardinality());
$definition->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
$this->assertEquals(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, $definition->getCardinality());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.