You are here

protected function FractionConstraintTest::setUp in Fraction 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/Plugin/Constraints/FractionConstraintTest.php \Drupal\Tests\fraction\Kernel\Plugin\Constraints\FractionConstraintTest::setUp()

Overrides EntityKernelTestBase::setUp

File

tests/src/Kernel/Plugin/Constraints/FractionConstraintTest.php, line 43

Class

FractionConstraintTest
Tests Constraint for Fraction.

Namespace

Drupal\Tests\fraction\Kernel\Plugin\Constraints

Code

protected function setUp() {
  parent::setUp();
  NodeType::create([
    'type' => 'article',
    'label' => 'Article',
  ])
    ->save();
  FieldStorageConfig::create([
    'entity_type' => 'node',
    'field_name' => self::FIELD_NAME,
    'type' => 'fraction',
    'cardinality' => 1,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'node',
    'field_name' => self::FIELD_NAME,
    'bundle' => 'article',
  ])
    ->save();
  $this->entity = $this->entityTypeManager
    ->getStorage('node')
    ->create([
    'type' => 'article',
    'title' => 'test',
    self::FIELD_NAME => [
      'numerator' => 1,
      'denominator' => 1,
    ],
  ]);
}