public function testEqualsWithValidParentAssociationMappings() { $filter = new StringFilter(); $filter->initialize('field_name', array('format' => '%s', 'field_name' => 'field_name', 'parent_association_mappings' => array(array('fieldName' => 'association_mapping'), array('fieldName' => 'sub_association_mapping'), array('fieldName' => 'sub_sub_association_mapping')))); $builder = new ProxyQuery($this->getQueryBuilder()); $filter->apply($builder, array('type' => ChoiceType::TYPE_EQUAL, 'value' => 'asd')); $this->assertEquals(true, $filter->isActive()); }
public function testOr() { $filter = new StringFilter(); $filter->initialize('field_name', array('format' => '%s')); $filter->setCondition(Filter::CONDITION_OR); $builder = new ProxyQuery($this->getQueryBuilder()); $builder->getQueryBuilder()->expects($this->once())->method('addOr'); $filter->filter($builder, 'alias', 'field', array('value' => 'asd', 'type' => ChoiceType::TYPE_CONTAINS)); $this->assertEquals(true, $filter->isActive()); $filter->setCondition(Filter::CONDITION_AND); $builder = new ProxyQuery($this->getQueryBuilder()); $builder->getQueryBuilder()->expects($this->never())->method('addOr'); $filter->filter($builder, 'alias', 'field', array('value' => 'asd', 'type' => ChoiceType::TYPE_CONTAINS)); $this->assertEquals(true, $filter->isActive()); }