You are here

public function BaseFieldDefinitionTest::testFieldStorageRequired in Drupal 8

Same name and namespace in other branches
  1. 9 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 312

Class

BaseFieldDefinitionTest
Unit test for BaseFieldDefinition.

Namespace

Drupal\Tests\Core\Entity

Code

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