public function validateParams($type, &$params = array()) { try { parent::validateParams($type, $params); } catch (InvalidArgumentException $e) { // Dirty solution, but in near future parent class will be disappear, // and it will be not necessary if ($e->getMessage() == 'Invalid report type') { switch ($type) { case ReportModel::SMIP_CONSUMPTION_MONTHLY: $this->validateParamsSmipConsumptionMonthly($params); break; case ReportModel::SMIP_CONSUMPTION_DAILY: $this->validateParamsSmipConsumptionDaily($params); break; default: throw $e; } } else { throw $e; } } }
/** * @expectedException Application\Exceptions\NotAllowedException */ public function testInvalidCustomerOrg() { self::initAuthUser(self::CUSTOMER_USER_ID); $params = array(ReportFilterFields::ORGANIZATION => self::PROVIDER_COMMERCIAL_ORG_ID, 'start' => '2013-02-03', 'end' => '2013-02-07'); $this->_reportService->validateParams(ReportModel::CONSUMPTION_DETAIL_DAILY, $params); }