Skip to content

Commit

Permalink
Merge pull request #290 from prooph/it_loads_and_saves_within_one_tra…
Browse files Browse the repository at this point in the history
…nsaction

add test it_loads_and_saves_within_one_transaction
  • Loading branch information
codeliner committed Jun 18, 2017
2 parents 6134642 + fdc56bd commit e9678e8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/TransactionalEventStoreTestTrait.php
Expand Up @@ -14,6 +14,7 @@

use ArrayIterator;
use Prooph\EventStore\EventStore;
use Prooph\EventStore\Exception\StreamNotFound;
use Prooph\EventStore\Exception\TransactionAlreadyStarted;
use Prooph\EventStore\Exception\TransactionNotStarted;
use Prooph\EventStore\Stream;
Expand Down Expand Up @@ -217,4 +218,28 @@ public function it_throws_exception_when_no_transaction_started_on_rollback(): v

$this->eventStore->rollback();
}

/**
* @test
*/
public function it_loads_and_saves_within_one_transaction(): void
{
$testStream = $this->getTestStream();

$this->eventStore->beginTransaction();

$streamNotFound = false;

try {
$this->eventStore->load($testStream->streamName());
} catch (StreamNotFound $e) {
$streamNotFound = true;
}

$this->assertTrue($streamNotFound);

$this->eventStore->create($testStream);

$this->eventStore->commit();
}
}

0 comments on commit e9678e8

Please sign in to comment.