Пример #1
0
 public function testChangePassword()
 {
     $user1 = $this->dummyData->getUser();
     $this->userRepository->shouldReceive('findOneById')->with($user1->getid())->andReturn($user1)->once();
     $this->userRepository->shouldReceive('update')->once();
     $newPassword = '******';
     $this->userService->changePassword($user1->getId(), $newPassword);
     $this->assertTrue($user1->verifyPassword($newPassword));
 }
Пример #2
0
 public function testSetUserById()
 {
     $user = $this->dummyData->getUser();
     $this->userRepository->shouldReceive('findOneById')->with($user->getId())->andReturn($user)->once();
     $cart = $this->getCartThatRepositoryWillFind();
     $this->cartRepositoryShouldUpdateOnce($cart);
     $this->cartService->setUserById($cart->getId(), $user->getId());
     $this->assertSame($user, $cart->getUser());
 }