/** * @covers DoctrineExtensions\NestedSet\NodeWrapper::insertAsPrevSiblingOf * @covers DoctrineExtensions\NestedSet\NodeWrapper::shiftRLRange * @covers DoctrineExtensions\NestedSet\NodeWrapper::insertNode */ public function testInsertAsPrevSiblingOf() { $newNode = new NodeWrapper(new SingleRootNodeMock(21, '1.1.1(.5)'), $this->nsm); $newNode->insertAsPrevSiblingOf($this->wrappers[3]); $this->assertEquals(5, $newNode->getLeftValue(), '->insertAsPrevSiblingOf() updates new node\'s left value'); $this->assertEquals(6, $newNode->getRightValue(), '->insertAsPrevSiblingOf() updates new node\'s right value'); $this->assertEquals(3, $this->wrappers[2]->getLeftValue(), '->insertAsPrevSiblingOf updates prev node\'s left value'); $this->assertEquals(4, $this->wrappers[2]->getRightValue(), '->insertAsPrevSiblingOf updates prev node\'s right value'); $this->assertEquals(7, $this->wrappers[3]->getLeftValue(), '->insertAsPrevSiblingOf updates next node\'s left value'); $this->assertEquals(8, $this->wrappers[3]->getRightValue(), '->insertAsPrevSiblingOf updates next node\'s right value'); }
/** * @covers DoctrineExtensions\NestedSet\NodeWrapper::insertAsPrevSiblingOf * @expectedException InvalidArgumentException */ public function testInsertAsPrevSiblingOf_CantInsertSelf() { $newNode = new NodeWrapper(new NodeMock(21, '1.1.1(.5)'), $this->nsm); $newNode->insertAsPrevSiblingOf($newNode); }