/** * @test */ public function itShouldConstructTheCommand() { $command = CreateUserCommand::create($this->userId, $this->user, $this->language, $this->context); $this->assertEquals($this->userId, $command->getId()); $this->assertEquals($this->user, $command->getOriginalUser()); $this->assertEquals(CreateUserCommand::NAME, $command->getCommandName()); $this->assertEquals($this->context, $command->getContext()); $this->assertEquals($this->language, $command->getPreferredLanguage()); }
public function setUp() { $faker = Factory::create(); $this->userId = new ApplicationUserId($faker->uuid); $this->userName = $faker->userName; $this->language = $faker->countryISOAlpha3; $this->account = \Mockery::mock(Account::class); $this->user = \Mockery::mock(SourcedUser::class); $this->command = CreateUserCommand::create($this->userId, $this->user, $this->language); $this->userFactory = \Mockery::mock(UserFactory::class); $this->accountFactory = \Mockery::mock(AccountFactory::class); $this->userRepository = \Mockery::spy(UserEventSourcedRepository::class); $this->errorHandler = \Mockery::spy(ErrorEventHandler::class); $this->serviceUnderTest = new MessageAppCommandHandler($this->userFactory, $this->userRepository, $this->accountFactory, $this->errorHandler); }