/**
  * @test
  */
 public function event_is_converted_to_stream_data()
 {
     $uuid = new UUID();
     $event = new WritableEvent($uuid, 'Foo', ['bar']);
     $streamData = ['eventId' => $uuid->toNative(), 'eventType' => 'Foo', 'data' => ['bar'], 'metadata' => []];
     $this->assertEquals($streamData, $event->toStreamData());
 }
 /**
  * @test
  */
 public function event_collection_is_converted_to_stream_data()
 {
     $uuid1 = new UUID();
     $event1 = new WritableEvent($uuid1, 'Foo', ['bar']);
     $uuid2 = new UUID();
     $event2 = new WritableEvent($uuid2, 'Baz', ['foo']);
     $eventCollection = new WritableEventCollection([$event1, $event2]);
     $streamData = [['eventId' => $uuid1->toNative(), 'eventType' => 'Foo', 'data' => ['bar'], 'metadata' => []], ['eventId' => $uuid2->toNative(), 'eventType' => 'Baz', 'data' => ['foo'], 'metadata' => []]];
     $this->assertEquals($streamData, $eventCollection->toStreamData());
 }
 public function testSameValueAs()
 {
     $uuid1 = new UUID();
     $uuid2 = clone $uuid1;
     $uuid3 = new UUID();
     $this->assertTrue($uuid1->sameValueAs($uuid2));
     $this->assertFalse($uuid1->sameValueAs($uuid3));
     $mock = $this->getMock('EventStore\\ValueObjects\\ValueObjectInterface');
     $this->assertFalse($uuid1->sameValueAs($mock));
 }
 /**
  * @return array
  */
 public function toStreamData()
 {
     return ['eventId' => $this->uuid->toNative(), 'eventType' => $this->type, 'data' => $this->data, 'metadata' => $this->metadata];
 }