function BaseFieldDefinitionTest::testFieldStorageRequired

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldStorageRequired()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldStorageRequired()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php \Drupal\Tests\Core\Entity\BaseFieldDefinitionTest::testFieldStorageRequired()

Tests storage required.

@covers ::isStorageRequired @covers ::setStorageRequired

File

core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php, line 318

Class

BaseFieldDefinitionTest
Unit test for BaseFieldDefinition.

Namespace

Drupal\Tests\Core\Entity

Code

public function testFieldStorageRequired() : void {
    $definition = BaseFieldDefinition::create($this->fieldType);
    $this->assertFalse($definition->isStorageRequired());
    $definition->setStorageRequired(TRUE);
    $this->assertTrue($definition->isStorageRequired());
    $definition->setStorageRequired(FALSE);
    $this->assertFalse($definition->isStorageRequired());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.