public function BaseFieldDefinitionTest::testFieldRequired in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldRequired()
Tests required.
@covers ::isRequired @covers ::setRequired
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ BaseFieldDefinitionTest.php, line 253 - Contains \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest.
Class
- BaseFieldDefinitionTest
- Unit test for BaseFieldDefinition.
Namespace
Drupal\Tests\Core\EntityCode
public function testFieldRequired() {
$definition = BaseFieldDefinition::create($this->fieldType);
$this
->assertFalse($definition
->isRequired());
$definition
->setRequired(TRUE);
$this
->assertTrue($definition
->isRequired());
$definition
->setRequired(FALSE);
$this
->assertFalse($definition
->isRequired());
}