protected function UserPointsTransactionTest::prepareTransactionBalanceField in User Points 8
Creates the balance field in the transaction entity type.
1 call to UserPointsTransactionTest::prepareTransactionBalanceField()
- UserPointsTransactionTest::prepareTransactionType in tests/src/ Kernel/ UserPointsTransactionTest.php 
- Creates and initializes the transaction type to be tested.
File
- tests/src/ Kernel/ UserPointsTransactionTest.php, line 87 
Class
- UserPointsTransactionTest
- Tests the user points transactor.
Namespace
Drupal\Tests\userpoints\KernelCode
protected function prepareTransactionBalanceField() {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_balance',
    'type' => 'decimal',
    'entity_type' => 'transaction',
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'label' => 'Points balance',
    'field_storage' => $field_storage,
    'bundle' => $this->transactionType
      ->id(),
  ])
    ->save();
}