/** * @expectedException \Sententiaregum\User\Application\Exception\FollowerException */ public function testLoadRandomUsersBecauseOfEmptyResult() { $this->user->follow(User::fromDTO(new CreateUserDTO('test', 'foo123', '*****@*****.**'))); $userRepository = $this->getMock(UserRepositoryInterface::class); $userRepository->expects($this->once())->method('findFollowingByFollowing')->will($this->returnValue([])); $service = new FollowerService($userRepository); $service->adviceFollowersByUser($this->user); }
public function testFollowNewUser() { $target = User::fromDTO(new CreateUserDTO('foo', 'bar', '*****@*****.**')); $user = new User(new Credentials('Ma27', 'test-pwd'), new UserDetails('*****@*****.**', new \DateTime(), new \DateTime())); $user->follow($target); $this->assertTrue($user->follows('foo')); $this->assertCount(1, $user->getFollowing()); }