/** * Init the mocks */ public function setUp() { $faker = Factory::create(); $this->event = \Mockery::mock(UserEvent::class); $this->contextValue = 'contextValue'; $this->context = \Mockery::mock(Context::class); $this->context->shouldReceive('getValue')->andReturn($this->contextValue); $this->source = 'src'; $this->sourceMessage = \Mockery::mock(SourceMessage::class); $this->sourceMessage->shouldReceive('getSource')->andReturn($this->source); $this->message = \Mockery::mock(Message::class); $this->userId = new ApplicationUserId($faker->uuid); $this->userName = $faker->userName; $this->user = \Mockery::mock(ApplicationUser::class); $this->user->shouldReceive('getId')->andReturn($this->userId); $this->user->shouldReceive('getName')->andReturn($this->userName); $this->userFinder = \Mockery::mock(AppUserFinder::class); $this->messageFinder = \Mockery::mock(MessageFinder::class); $this->factory = \Mockery::mock(MessageFactory::class); $this->messageSender = \Mockery::mock(MessageSender::class); $this->serviceUnderTest = new UserEventHandler($this->userFinder, $this->messageFinder, $this->factory, $this->messageSender); }
private function assertUserWillNotBeLinkedToThirdPartyAccount() { $this->user->shouldReceive('setThirdPartyAccount')->with($this->thirdPartyAccount)->never(); }
private function givenUserAsAPreferredLanguage() { $this->user->shouldReceive('getPreferredLanguage')->andReturn($this->language); }