public function testHandlerForEventBookAdded() { $id = Uuid::createNew(); $title = 'foo'; $isbn = 'bar'; $event = new BookAdded($id, [], $title, $isbn); $storage = $this->getMockBuilder(Storage::class)->disableOriginalConstructor()->getMock(); $storage->expects(self::once())->method('upsert')->with($id, self::anything()); $service = new BookService($storage); $service->onBookAdded($event); }