public function setUp()
 {
     $this->thingId = ThingId::fromString('014ec11d-2f21-4d33-a624-5df1196a4f85');
     $this->thingType = Type::create(Thing::class);
     $this->metaData = new MetaData(['ip_address' => '127.0.0.1']);
     $this->committed = 3;
     $this->version = 6;
 }
Example #2
0
 public function setUp()
 {
     $thingId = ThingId::fromString('014ec11d-2f21-4d33-a624-5df1196a4f85');
     $thingType = Type::create(Thing::class);
     $messageId = MessageId::fromString('014ec11e-4343-49cd-9b7a-cdd4ced5cedc');
     $timestamp = DateTime::fromString('2015-01-01T13:12:31.045234[America/Chicago]');
     $payload = new ThingHappenedEvent('foo', 'bar');
     $metaData = new MetaData(['ip_address' => '127.0.0.1']);
     $sequence = 0;
     $this->eventMessage = new DomainEventMessage($thingId, $thingType, $messageId, $timestamp, $payload, $metaData, $sequence);
     $this->storedEvent = new StoredEvent($this->eventMessage);
 }
Example #3
0
 public function test_that_event_is_dispatched_to_attached_service()
 {
     $dispatcher = $this->container->get('event.dispatcher');
     $dispatcher->attachService('test.subscriber', TestSubscriber::class);
     $dispatcher = new FrozenDispatcher($dispatcher);
     $thingId = ThingId::fromString('014ec11d-2f21-4d33-a624-5df1196a4f85');
     $thingType = Type::create(Thing::class);
     $messageId = MessageId::fromString('014ec11e-4343-49cd-9b7a-cdd4ced5cedc');
     $timestamp = DateTime::fromString('2015-01-01T13:12:31.045234[America/Chicago]');
     $payload = new ThingHappenedEvent('foo', 'bar');
     $metaData = new MetaData();
     $sequence = 0;
     $eventMessage = new DomainEventMessage($thingId, $thingType, $messageId, $timestamp, $payload, $metaData, $sequence);
     $dispatcher->dispatch($eventMessage);
     $this->assertTrue($this->container->get('test.subscriber')->thingHappened());
 }
 public function test_that_all_events_key_subscribes_to_any_event()
 {
     $subscriber = new EventLogSubscriber();
     $this->dispatcher->attach($subscriber);
     $thingId = ThingId::fromString('014ec11d-2f21-4d33-a624-5df1196a4f85');
     $thingType = Type::create(Thing::class);
     $messageId = MessageId::fromString('014ec11e-4343-49cd-9b7a-cdd4ced5cedc');
     $timestamp = DateTime::fromString('2015-01-01T13:12:31.045234[America/Chicago]');
     $payload = new ThingHappenedEvent('foo', 'bar');
     $metaData = new MetaData();
     $sequence = 0;
     $eventMessage = new DomainEventMessage($thingId, $thingType, $messageId, $timestamp, $payload, $metaData, $sequence);
     $this->dispatcher->dispatch($eventMessage);
     $logs = $subscriber->getLogs();
     $expected = '{"message_id":"014ec11e-4343-49cd-9b7a-cdd4ced5cedc",' . '"timestamp":"2015-01-01T13:12:31.045234[America/Chicago]",' . '"event_type":"Novuso.Test.Common.Doubles.Domain.Messaging.Event.ThingHappenedEvent",' . '"event_data":{"foo":"foo","bar":"bar"},"meta_data":[],' . '"aggregate_type":"Novuso.Test.Common.Doubles.Domain.Model.Thing",' . '"aggregate_id":"014ec11d-2f21-4d33-a624-5df1196a4f85","sequence":0}';
     $this->assertSame($expected, $logs[0]);
 }
Example #5
0
 public function test_that_hash_value_returns_expected_string()
 {
     $thingId = ThingId::fromString('014ea33a-d902-4025-8b53-01191406579d');
     $this->assertSame('014ea33ad90240258b5301191406579d', $thingId->hashValue());
 }
Example #6
0
 public function setUp()
 {
     $thingId = ThingId::fromString('014ec11d-2f21-4d33-a624-5df1196a4f85');
     $thingType = Type::create(Thing::class);
     $this->eventCollection = new EventCollection($thingId, $thingType);
 }
 protected function getNextEvent()
 {
     $thingId = ThingId::fromString('014ec11d-2f21-4d33-a624-5df1196a4f85');
     $thingType = Type::create(Thing::class);
     $messageId = MessageId::fromString('014ec11f-317e-475a-9d5f-b8ae6c20aab1');
     $timestamp = DateTime::fromString('2015-01-02T10:34:12.672291[America/Chicago]');
     $metaData = new MetaData();
     $payload = new ThingHappenedEvent('foo', 'bar');
     $sequence = 1;
     return new DomainEventMessage($thingId, $thingType, $messageId, $timestamp, $payload, $metaData, $sequence);
 }