You are here

protected function BalanceTransactionTest::prepareTransactionBalanceField in Transaction 8

Creates the balance field in the transaction entity type.

1 call to BalanceTransactionTest::prepareTransactionBalanceField()
BalanceTransactionTest::prepareTransactionType in tests/src/Kernel/BalanceTransactionTest.php
Creates and initializes the transaction type to be tested.

File

tests/src/Kernel/BalanceTransactionTest.php, line 67

Class

BalanceTransactionTest
Tests the balance transactor.

Namespace

Drupal\Tests\transaction\Kernel

Code

protected function prepareTransactionBalanceField() {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_balance',
    'type' => 'decimal',
    'entity_type' => 'transaction',
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'label' => 'Balance',
    'field_storage' => $field_storage,
    'bundle' => $this->transactionType
      ->id(),
  ])
    ->save();
}