public function testValidationFailure() { $this->setExpectedException('\\Exception'); $_GET = array('param' => 'value'); $validator = $this->getMock('\\fajr\\validators\\InputValidator'); $validator->expects($this->once())->method('validate')->with($this->equalTo('value'))->will($this->throwException(new Exception())); $input = new HttpInputParameters(array('param' => $validator), array()); $input->prepare(); }
public static function getInstance() { if (!isset(self::$instance)) { $allowed_get = array('studium' => new IntegerValidator(false), 'list' => new IntegerValidator(false), 'predmet' => new IntegerValidator(false), 'termin' => new IntegerValidator(false), 'action' => new StringValidator(), 'code' => new StringValidator(), 'loginType' => new StringValidator(), 'serverName' => new StringValidator(), 'format' => new StringValidator(), 'displayFilter' => new StringValidator(), 'year' => new IntegerValidator(false), 'month' => new IntegerValidator(false), 'mode' => new StringValidator()); $allowed_post = array('prihlasPredmetIndex' => new IntegerValidator(false), 'prihlasTerminIndex' => new IntegerValidator(false), 'odhlasIndex' => new IntegerValidator(false), 'hash' => new StringValidator(), 'action' => new StringValidator(), 'login' => new StringValidator(), 'password' => new StringValidator(), 'cosignCookie' => new StringValidator(), 'loginType' => new StringValidator(), 'serverName' => new StringValidator(), 'skinSelect' => new StringValidator()); self::$instance = new HttpInputParameters($allowed_get, $allowed_post); self::$instance->prepare(); } return self::$instance; }