Doctrine\Tests\ODM\PHPCR\Query\Builder\ConverterPhpcrTest::testOrderBy PHP Метод

testOrderBy() публичный Метод

public testOrderBy ( )
    public function testOrderBy()
    {
        $this->primeBuilder();
        $order1 = $this->createNode('Ordering', array(QOMConstants::JCR_ORDER_ASCENDING));
        $order2 = $this->createNode('Ordering', array(QOMConstants::JCR_ORDER_ASCENDING));
        $order3 = $this->createNode('Ordering', array(QOMConstants::JCR_ORDER_DESCENDING));
        $orderBy = $this->createNode('OrderBy', array());
        $orderBy->addChild($order1);
        $orderBy->addChild($order2);
        $op = $this->createNode('OperandDynamicLocalName', array('alias_1'));
        $order1->addChild($op);
        $order2->addChild($op);
        $order3->addChild($op);
        $orderByAdd = $this->createNode('OrderByAdd', array());
        $orderByAdd->addChild($order3);
        // original adds 2 orderings
        $res = $this->converter->dispatch($orderBy);
        $this->assertCount(2, $res);
        // orderByAdd adds 1 ordering, making 3
        $res = $this->converter->dispatch($orderByAdd);
        $this->assertCount(3, $res);
        // redispatching orderBy resets so we only have 2 again
        $res = $this->converter->dispatch($orderBy);
        $this->assertCount(2, $res);
    }