Phalcon\Test\Mvc\Model\Behavior\NestedSetTest::testShouldAddBelowAndAbove PHP Method

testShouldAddBelowAndAbove() public method

Created nodes in the desired place
Since: 2016-03-01
Author: Serghei Iakovlev ([email protected])
    public function testShouldAddBelowAndAbove()
    {
        $this->specify('Unable to created nodes in the desired place', function () {
            $root = new CategoriesManyRoots();
            $root->name = 'ROOT';
            $root->saveNode();
            $node1 = new CategoriesManyRoots();
            $node1->name = 'A';
            $node1->appendTo($root);
            $node2 = new CategoriesManyRoots();
            $node2->name = 'B';
            $node2->appendTo($root);
            $node3 = new CategoriesManyRoots();
            $node3->name = 'C';
            $node3->prependTo($root);
            $expected = ['ROOT', '     C', '     A', '     B'];
            expect($this->prettifyRoots())->equals($expected);
            $this->checkIntegrity($root->root);
        });
    }