public function testPostLoginFailures()
{
$this->setRequest(Request::create('/bolt/login', 'POST', ['action' => 'login', 'username' => 'test', 'password' => 'pass']));
$app = $this->getApp();
$loginMock = $this->getMockLogin();
$loginMock->expects($this->once())->method('login')->with($this->equalTo('test'), $this->equalTo('pass'))->will($this->returnValue(false));
$this->setService('access_control.login', $loginMock);
$this->checkTwigForTemplate($this->getApp(), '@bolt/login/login.twig');
$this->controller()->postLogin($this->getRequest());
// Test missing data fails
$this->setRequest(Request::create('/bolt/login', 'POST', ['action' => 'fake']));
$this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\HttpException', 'Invalid request');
$this->controller()->postLogin($this->getRequest());
$this->setRequest(Request::create('/bolt/login', 'POST', []));
$this->checkTwigForTemplate($this->getApp(), 'error.twig');
$this->controller()->postLogin($this->getRequest());
}