You are here

public function GenericTransactionTest::testGenericTransactionCreation in Transaction 8

Tests generic transaction creation.

File

tests/src/Kernel/GenericTransactionTest.php, line 40

Class

GenericTransactionTest
Tests the generic transactor.

Namespace

Drupal\Tests\transaction\Kernel

Code

public function testGenericTransactionCreation() {
  $transaction = $this->transaction;

  // Checks status for new non-executed transaction.
  $this
    ->assertEquals($this->targetEntity, $transaction
    ->getTargetEntity());
  $this
    ->assertEquals('Unsaved transaction (pending)', $transaction
    ->getDescription());
  $this
    ->assertEquals([
    $this->logMessage,
  ], $transaction
    ->getDetails());
  $this
    ->assertNull($transaction
    ->getExecutionTime());
  $this
    ->assertNull($transaction
    ->getExecutor());
  $this
    ->assertFalse($transaction
    ->getResultCode());
  $this
    ->assertFalse($transaction
    ->getResultMessage());
  $transaction
    ->save();
  $this
    ->assertEquals('Transaction 1 (pending)', $transaction
    ->getDescription());
}