function BaseFieldDefinitionTest::testFieldCardinality
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldCardinality()
- 8.9.x 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()
Tests field cardinality.
@covers ::getCardinality @covers ::setCardinality
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ BaseFieldDefinitionTest.php, line 288
Class
- BaseFieldDefinitionTest
- Unit test for BaseFieldDefinition.
Namespace
Drupal\Tests\Core\EntityCode
public function testFieldCardinality() : void {
$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.