public function testGetValidOperatorTypesForAllAttributeTypes() { $model = new ReportModelTestItem(); $this->assertEquals('BooleanForWizardStaticDropDown', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'boolean')); $this->assertEquals('MixedCurrencyValueTypes', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'currencyValue')); $this->assertEquals('MixedDateTypesForReport', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'date')); $this->assertEquals('MixedDateTypesForReport', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'dateTime')); $this->assertEquals('StaticDropDownForReport', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'dropDown')); $this->assertEquals('MixedNumberTypes', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'float')); $this->assertEquals('MixedNumberTypes', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'integer')); $this->assertEquals('StaticDropDownForReport', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'multiDropDown')); $this->assertEquals('Text', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'phone')); $this->assertEquals('StaticDropDownForReport', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'radioDropDown')); $this->assertEquals('Text', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'string')); $this->assertEquals('StaticDropDownForReport', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'tagCloud')); $this->assertEquals('Text', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'textArea')); $this->assertEquals('Text', ModeAttributeToReportFilterValueElementTypeUtil::getType($model, 'url')); }
/** * @param string $attribute * @return null|string * @throws NotSupportedException if the attribute is dynamically derived but not a __User attribute since * this is the only type of dynamically derived attributes that are currently supported */ public function getFilterValueElementType($attribute) { assert('is_string($attribute)'); if ($this->isDerivedAttribute($attribute)) { return null; } if ($this->isDynamicallyDerivedAttribute($attribute)) { $parts = explode(FormModelUtil::DELIMITER, $attribute); if ($parts[1] != 'User') { throw new NotSupportedException(); } return 'UserNameId'; } $resolvedAttribute = static::resolveRealAttributeName($attribute); if (null != ($filterValueElementTypeFromRule = $this->rules->getFilterValueElementType($this->model, $resolvedAttribute))) { return $filterValueElementTypeFromRule; } return ModeAttributeToReportFilterValueElementTypeUtil::getType($this->model, $resolvedAttribute); }