/** * @test * @expectedException \Veloci\User\Exception\AuthenticationFailException */ public function shouldNotLogin() { $userSession = $this->mockUserSession(); $user = $this->mockUser(); $this->userRepository->shouldReceive('exists')->once()->with($user)->andReturn(false); $result = $this->manager->login($user); PHPUnit_Framework_Assert::assertEquals($userSession, $result); }
/** * @When /^I login$/ */ public function iLogin() { try { $this->userSession = $this->authenticationManager->login($this->user); } catch (Exception $ex) { $this->lastException = $ex; } }