/**
  * @param $existingValue
  * @param $operator
  * @param $valueForValidate
  * @param $expectedResult
  * @param $inputType
  *
  * @dataProvider validateAttributeArrayInputTypeDataProvider
  */
 public function testValidateArrayOperatorType($existingValue, $operator, $valueForValidate, $expectedResult, $inputType)
 {
     $this->_condition->setOperator($operator);
     $this->_condition->setData('value_parsed', $existingValue);
     $this->_condition->getDefaultOperatorInputByType();
     $this->_condition->expects($this->any())->method('getInputType')->will($this->returnValue($inputType));
     $this->assertEquals($expectedResult, $this->_condition->validateAttribute($valueForValidate), "Failed asserting that " . var_export($existingValue, true) . $operator . var_export($valueForValidate, true));
 }
Exemplo n.º 2
0
 /**
  * Customize default operator input by type mapper for some types
  *
  * @return array
  */
 public function getDefaultOperatorInputByType()
 {
     if (null === $this->_defaultOperatorInputByType) {
         parent::getDefaultOperatorInputByType();
         /*
          * '{}' and '!{}' are left for back-compatibility and equal to '==' and '!='
          */
         $this->_defaultOperatorInputByType['category'] = array('==', '!=', '{}', '!{}', '()', '!()');
         $this->_arrayInputTypes[] = 'category';
         /*
          * price and price range modification
          */
         $this->_defaultOperatorInputByType['price'] = array('==', '!=', '>=', '>', '<=', '<', '{}', '!{}');
     }
     return $this->_defaultOperatorInputByType;
 }