Doctrine\Tests\ODM\PHPCR\Query\Builder\ConverterPhpcrTest::testDispatchWheres PHP Method

testDispatchWheres() public method

public testDispatchWheres ( $logicalOp, $skipOriginalWhere = false )
    public function testDispatchWheres($logicalOp, $skipOriginalWhere = false)
    {
        $this->primeBuilder();
        if ($skipOriginalWhere) {
            $where = $this->createNode('Where' . $logicalOp, array());
        } else {
            $where = $this->createNode('Where', array());
        }
        $constraint = $this->createNode('ConstraintFieldIsset', array('alias_1.foobar'));
        $where->addChild($constraint);
        $res = $this->converter->dispatch($where);
        $this->assertInstanceOf('PHPCR\\Query\\QOM\\PropertyExistenceInterface', $res);
        $this->assertEquals('alias_1', $res->getSelectorName());
        $this->assertEquals('foobar_phpcr', $res->getPropertyName());
        // test add / or where (see dataProvider)
        $whereCon = $this->createNode('Where' . $logicalOp, array());
        $constraint = $this->createNode('ConstraintFieldIsset', array('alias_1.barfoo'));
        $whereCon->addChild($constraint);
        $res = $this->converter->dispatch($whereCon);
        $this->assertInstanceOf('PHPCR\\Query\\QOM\\' . $logicalOp . 'Interface', $res);
        $this->assertEquals('foobar_phpcr', $res->getConstraint1()->getPropertyName());
        $this->assertEquals('barfoo_phpcr', $res->getConstraint2()->getPropertyName());
    }