-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
align in memory event store and stream with pdo implementations:
- when filtering by no producers whole stream should be returned - in memory event store did not use producer type in internal streams
- Loading branch information
Showing
2 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
use Streak\Infrastructure\EventBus\PDOPostgresEventStoreTest\Event3; | ||
use Streak\Infrastructure\EventBus\PDOPostgresEventStoreTest\Event4; | ||
use Streak\Infrastructure\EventBus\PDOPostgresEventStoreTest\ProducerId1; | ||
use Streak\Infrastructure\EventBus\PDOPostgresEventStoreTest\ProducerId2; | ||
|
||
/** | ||
* @author Alan Gabriel Bem <[email protected]> | ||
|
@@ -83,8 +84,9 @@ public function testObject() | |
{ | ||
$this->assertSame($this->store->log(), $this->store->log()); | ||
|
||
$producer11 = new ProducerId1('producer1-1'); | ||
$producer12 = new ProducerId1('producer1-2'); | ||
$producer11 = new ProducerId1('producer1'); | ||
$producer12 = new ProducerId1('producer2'); | ||
$producer21 = new ProducerId2('producer1'); | ||
|
||
$event111 = new Event1(); | ||
$event112 = new Event2(); | ||
|
@@ -96,6 +98,11 @@ public function testObject() | |
$event123 = new Event3(); | ||
$event124 = new Event4(); | ||
|
||
$event211 = new Event1(); | ||
$event212 = new Event2(); | ||
$event213 = new Event3(); | ||
$event214 = new Event4(); | ||
|
||
$this->assertEquals([], iterator_to_array($this->store->log())); | ||
|
||
$stream = $this->store->stream($producer11); | ||
|
@@ -210,6 +217,20 @@ public function testObject() | |
$this->assertFalse($stream->empty()); | ||
$this->assertEquals($event111, $stream->first()); | ||
$this->assertEquals($event124, $stream->last()); | ||
|
||
$this->store->add($producer21, 0, $event211, $event212, $event213, $event214); | ||
|
||
$stream = $this->store->stream($producer21); | ||
$this->assertEquals([$event211, $event212, $event213, $event214], iterator_to_array($stream)); | ||
$this->assertFalse($stream->empty()); | ||
$this->assertEquals($event211, $stream->first()); | ||
$this->assertEquals($event214, $stream->last()); | ||
|
||
$stream = $this->store->stream(); | ||
$this->assertEquals([$event111, $event112, $event113, $event114, $event121, $event122, $event123, $event124, $event211, $event212, $event213, $event214], iterator_to_array($stream)); | ||
$this->assertFalse($stream->empty()); | ||
$this->assertEquals($event111, $stream->first()); | ||
$this->assertEquals($event214, $stream->last()); | ||
} | ||
|
||
public function testConcurrentWriting() | ||
|