public function testLogin_Exception() { $email = '*****@*****.**'; $password = '******'; $ip = '127.0.0.1'; $emMock = $this->getMockBuilder('\\Box_EventManager')->getMock(); $emMock->expects($this->atLeastOnce())->method('fire')->will($this->returnValue(true)); $dbMock = $this->getMockBuilder('\\Box_Database')->getMock(); $dbMock->expects($this->atLeastOnce())->method('findOne')->will($this->returnValue(null)); $di = new \Box_Di(); $di['events_manager'] = $emMock; $di['db'] = $dbMock; $service = new \Box\Mod\Staff\Service(); $service->setDi($di); $this->setExpectedException('\\Box_Exception', 'Check your login details', 403); $service->login($email, $password, $ip); }