protected function UserPointsTransactionTest::prepareTransactionType in User Points 8
Creates and initializes the transaction type to be tested.
Overrides KernelTransactionTestBase::prepareTransactionType
File
- tests/
src/ Kernel/ UserPointsTransactionTest.php, line 40
Class
- UserPointsTransactionTest
- Tests the user points transactor.
Namespace
Drupal\Tests\userpoints\KernelCode
protected function prepareTransactionType() {
$this->transactionType = TransactionType::create([
'id' => 'test_userpoints',
'label' => 'Test user points',
'target_entity_type' => 'user',
'transactor' => [
'id' => 'userpoints',
'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();
}