/** * @before */ public function setUpTestFilter() { $this->filter = new TestFilter(); $this->filter->defineFilter($this->getFilterDefinition()); }
/** @test */ public function it_can_filter_on_embeddables_on_relationships() { if (!$this->isAtLeastDoctrineVersion('2.5')) { $this->markTestSkipped('Embeddables not available prior to Doctrine 2.5'); } $filter = new TestFilter(); $filter->defineFilter(function (FilterBuilder $builder) { $builder->add('horsepower', GreaterThanEqualFilterType::class, ['fields' => 'ships.engine.horsepower']); }); $res1 = $this->em->getRepository(Harbour::class)->filter($filter, ['horsepower' => 400]); $this->assertEmpty($res1); $res2 = $this->em->getRepository(Harbour::class)->filter($filter, ['horsepower' => 300]); $this->assertCount(1, $res2); }