You are here

protected function UserPointsTransactionTest::prepareTargetEntityBalanceField in User Points 8

Creates the balance field in the target entity type.

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

File

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

Class

UserPointsTransactionTest
Tests the user points transactor.

Namespace

Drupal\Tests\userpoints\Kernel

Code

protected function prepareTargetEntityBalanceField() {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_balance',
    'type' => 'decimal',
    'entity_type' => 'user',
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'label' => 'Points',
    'field_storage' => $field_storage,
    'bundle' => 'user',
  ])
    ->save();
}