|
@@ -80,4 +80,38 @@ class StringFilterTest extends \PHPUnit_Framework_TestCase
|
|
|
$this->assertEquals(array('field_name_0' => 'asd'), $builder->parameters);
|
|
|
$this->assertEquals(true, $filter->isActive());
|
|
|
}
|
|
|
+
|
|
|
+ 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(new QueryBuilder);
|
|
|
+ $this->assertEquals(array(), $builder->query);
|
|
|
+
|
|
|
+ $filter->apply($builder, array('type' => ChoiceType::TYPE_EQUAL, 'value' => 'asd'));
|
|
|
+
|
|
|
+ $this->assertEquals(array(
|
|
|
+ 'o.association_mapping',
|
|
|
+ 's_association_mapping.sub_association_mapping',
|
|
|
+ 's_association_mapping_sub_association_mapping.sub_sub_association_mapping',
|
|
|
+ 's_association_mapping_sub_association_mapping_sub_sub_association_mapping.field_name = :field_name_0'
|
|
|
+ ), $builder->query);
|
|
|
+ $this->assertEquals(array('field_name_0' => 'asd'), $builder->parameters);
|
|
|
+ $this->assertEquals(true, $filter->isActive());
|
|
|
+ }
|
|
|
}
|