function it_dumps_field_filters($registry, OutputInterface $output, HelperSet $helperSet, TableHelper $table, FieldFilterInterface $groupFilter) { $output->writeln(Argument::any())->shouldBeCalled(); $operators = ['IN', 'NOT IN', 'EMPTY', 'NOT EMPTY']; $fields = ['groups.id', 'groups.code']; $registry->getFieldFilters()->willReturn([$groupFilter]); $groupFilter->getOperators()->willReturn($operators); $groupFilter->getFields()->willReturn($fields); $helperSet->get('table')->willReturn($table); $headers = ['field', 'operators', 'filter_class']; $table->setHeaders($headers)->shouldBeCalled()->willReturn($table); $table->setRows(Argument::that(function ($param) { return 'groups.id' === $param[0][0] && 'IN, NOT IN, EMPTY, NOT EMPTY' === $param[0][1] && false !== strpos($param[0][2], 'FieldFilterInterface') && 'groups.code' === $param[1][0] && 'IN, NOT IN, EMPTY, NOT EMPTY' === $param[1][1] && false !== strpos($param[1][2], 'FieldFilterInterface'); }))->shouldBeCalled(); $table->render(Argument::any())->shouldBeCalled(); $this->dump($output, $helperSet); }
/** * Add a filter condition on a field * * @param FieldFilterInterface $filter the filter * @param string $field the field * @param string $operator the operator * @param mixed $value the value to filter * @param array $context the filter context * * @return ProductQueryBuilderInterface */ protected function addFieldFilter(FieldFilterInterface $filter, $field, $operator, $value, array $context) { $filter->setQueryBuilder($this->getQueryBuilder()); $filter->addFieldFilter($field, $operator, $value, $context['locale'], $context['scope'], $context); return $this; }