예제 #1
0
 public function testHandlerForEventAuthorAdded()
 {
     $bookId = Uuid::createNew();
     $firstName = 'foo';
     $lastName = 'bar';
     $storage = $this->getMockBuilder(Storage::class)->disableOriginalConstructor()->getMock();
     $storage->expects(self::once())->method('upsert')->with($bookId, self::anything());
     $storage->expects(self::once())->method('find')->with($bookId)->will(self::returnValue(new Book($bookId, new Authors(), 'foo', 'bar', true, -1)));
     $service = new BookService($storage);
     $service->onAuthorAdded(new AuthorAdded($bookId, $firstName, $lastName));
 }