public function testBuildNullValueExprNoAppropriateChildBuilder() { $ds = $this->getMock('Oro\\Bundle\\FilterBundle\\Datasource\\FilterDatasourceAdapterInterface'); $fieldName = 'o.testField'; $filterName = 'testFilter'; $inverse = true; $this->childBuilder1->expects($this->once())->method('supports')->with($this->identicalTo($ds))->will($this->returnValue(false)); $this->childBuilder1->expects($this->never())->method('buildNullValueExpr'); $this->setExpectedException('\\RuntimeException', sprintf('The "%s" datasource adapter is not supported.', get_class($ds))); $this->builder->buildNullValueExpr($ds, $fieldName, $filterName, $inverse); }
protected function setUp() { $reader = new AnnotationReader(); $metadataDriver = new AnnotationDriver($reader, 'Oro\\Bundle\\EntityExtendBundle\\Tests\\Unit\\Filter\\Fixtures'); $this->em = $this->getTestEntityManager(); $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver); $this->em->getConfiguration()->setEntityNamespaces(['Stub' => 'Oro\\Bundle\\EntityExtendBundle\\Tests\\Unit\\Filter\\Fixtures']); $this->formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface'); $doctrine = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->getMock(); $doctrine->expects($this->any())->method('getManagerForClass')->will($this->returnValue($this->em)); $manyRelationBuilder = new ManyRelationBuilder(); $manyRelationBuilder->addBuilder(new OrmManyRelationBuilder($doctrine)); $this->filter = new DictionaryFilter($this->formFactory, new FilterUtility(), $manyRelationBuilder); }
/** * {@inheritdoc} */ protected function buildNullValueExpr(FilterDatasourceAdapterInterface $ds, $comparisonType, $fieldName) { return $this->manyRelationBuilder->buildNullValueExpr($ds, $fieldName, $this->getName(), $comparisonType === ChoiceFilterType::TYPE_NOT_CONTAINS); }