Esempio n. 1
0
 public function setUp()
 {
     $book_type = new BookType();
     $author_type = new AuthorType();
     $this->projection_type_map = new ProjectionTypeMap([$book_type->getVariantPrefix() => $book_type, $author_type->getVariantPrefix() => $author_type]);
     $this->mock_connector = Mockery::mock(ConnectorInterface::CLASS);
     $this->mock_client = Mockery::mock(Client::CLASS);
 }
 /**
  * @dataProvider provideModifyCommands
  */
 public function testBuildModifyCommand(array $projection, array $payload, array $expected_command)
 {
     $author_type = new AuthorType();
     $projection_type = new AuthorProjectionType();
     $projection = $projection_type->createEntity($projection);
     $builder = new AggregateRootCommandBuilder($author_type, ModifyAuthorCommand::CLASS);
     $build_result = $builder->fromEntity($projection)->withValues($payload['author'])->build();
     $this->assertInstanceOf(Result::CLASS, $build_result);
     $this->assertInstanceOf(Success::CLASS, $build_result);
     $result = $build_result->get();
     $this->assertInstanceOf(ModifyAuthorCommand::CLASS, $result);
     $result_as_array = $result->toArray();
     $this->assertEquals($expected_command, $this->filterUuids($result_as_array));
 }