/**
  * {@inheritdoc}
  */
 public function addFieldFilter($field, $operator, $value, $locale = null, $scope = null, $options = [])
 {
     if (!is_bool($value)) {
         throw InvalidArgumentException::booleanExpected($field, 'filter', 'boolean', gettype($value));
     }
     $field = sprintf('%s.%s', ProductQueryUtility::NORMALIZED_FIELD, FieldFilterHelper::getCode($field));
     $this->qb->field($field)->equals($value);
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function addFieldFilter($field, $operator, $value, $locale = null, $scope = null, $options = [])
 {
     if (!is_bool($value)) {
         throw InvalidArgumentException::booleanExpected($field, 'filter', 'boolean', gettype($value));
     }
     $field = current($this->qb->getRootAliases()) . '.' . FieldFilterHelper::getCode($field);
     $condition = $this->prepareCriteriaCondition($field, $operator, $value);
     $this->qb->andWhere($condition);
     return $this;
 }
 /**
  * Check if data are valid
  *
  * @param AttributeInterface $attribute
  * @param mixed              $data
  */
 protected function checkData(AttributeInterface $attribute, $data)
 {
     if (!is_bool($data) && $data !== '0' && $data !== '1' && $data !== 0 && $data !== 1) {
         throw InvalidArgumentException::booleanExpected($attribute->getCode(), 'setter', 'boolean', gettype($data));
     }
 }
 function it_throws_an_error_if_data_is_not_a_boolean(AttributeInterface $attribute)
 {
     $attribute->getCode()->willReturn('attributeCode');
     $data = 'not a boolean';
     $this->shouldThrow(InvalidArgumentException::booleanExpected('attributeCode', 'setter', 'boolean', gettype($data)))->during('setValue', [[], $attribute, $data, 'fr_FR', 'mobile']);
 }
 function it_throws_an_exception_if_value_is_not_a_boolean()
 {
     $this->shouldThrow(InvalidArgumentException::booleanExpected('enabled', 'filter', 'boolean', gettype('not a boolean')))->during('addFieldFilter', ['enabled', '=', 'not a boolean']);
 }