You are here

protected function UserPointsTransactionTest::prepareTransactionAmountField in User Points 8

Creates the amount field in the transaction entity type.

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

File

tests/src/Kernel/UserPointsTransactionTest.php, line 69

Class

UserPointsTransactionTest
Tests the user points transactor.

Namespace

Drupal\Tests\userpoints\Kernel

Code

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