You are here

protected function BalanceTransactionTest::prepareTransactionType in Transaction 8

Creates and initializes the transaction type to be tested.

Overrides KernelTransactionTestBase::prepareTransactionType

File

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

Class

BalanceTransactionTest
Tests the balance transactor.

Namespace

Drupal\Tests\transaction\Kernel

Code

protected function prepareTransactionType() {
  $this->transactionType = TransactionType::create([
    'id' => 'test_balance',
    'label' => 'Test balance',
    'target_entity_type' => 'entity_test',
    'transactor' => [
      'id' => 'transaction_balance',
      'settings' => [
        'last_transaction' => 'field_last_transaction',
        'log_message' => 'field_log_message',
        'amount' => 'field_amount',
        'balance' => 'field_balance',
        'target_balance' => 'field_balance',
      ],
    ],
  ]);
  $this->transactionType
    ->save();
  $this
    ->prepareTransactionAmountField();
  $this
    ->prepareTransactionBalanceField();
  $this
    ->prepareTargetEntityBalanceField();

  // Adds the test log message field.
  $this
    ->addTransactionLogMessageField();
}