public function testPostLoginWithEmail() { $this->setRequest(Request::create('/bolt/login', 'POST', ['action' => 'login', 'username' => '[email protected]', 'password' => 'pass'])); $app = $this->getApp(); $loginMock = $this->getMockLogin(); $loginMock->expects($this->once())->method('login')->with($this->equalTo('[email protected]'), $this->equalTo('pass'))->will($this->returnValue(true)); $this->setService('access_control.login', $loginMock); $this->setSessionUser(new Entity\Users(['username' => 'test', 'email' => '[email protected]', 'roles' => []])); $this->addDefaultUser($this->getApp()); $response = $this->controller()->postLogin($this->getRequest()); $this->assertTrue($response->isRedirect('/bolt')); }