public function testIsValidWhenTakeALotOfArguments() { //all types that should be pass $this->assertTrue(ResponseType::isValid(ResponseType::CSV)); $this->assertTrue(ResponseType::isValid(ResponseType::HTML)); $this->assertTrue(ResponseType::isValid(ResponseType::JSON)); $this->assertTrue(ResponseType::isValid(ResponseType::XML)); $this->assertTrue(ResponseType::isValid(ResponseType::XLS)); $this->assertTrue(ResponseType::isValid(ResponseType::EMPT)); }
/** * Processa a requisição e renderiza a página * @param string $requestType GET, POST * @param string $action Refere-se ao método * @param string $responseType Tipo de retorno da pagina, JSON, PDF etc. */ public final function service($requestType, $action, $responseType) { //Definindo o tipo de resposta if (!ResponseType::isValid($responseType)) { $responseType = ResponseType::getDefaultType(); } $this->responseType = $responseType; //Definindo o método de requisição if (!RequestType::isValid($requestType)) { $requestType = RequestType::GET; } self::$requestType = $requestType; $this->cleanParameters(); $this->_processRequest($action); if ($this->render) { $this->render(); } }