public function testUpdateLoadedNodes() { $this->assertTrue(method_exists('NestedSetTable9Query', 'updateLoadedNodes'), 'nested_set adds a updateLoadedNodes() method'); $fixtures = $this->initTree(); \NestedSetTable9Query::shiftRLValues(1, 5); $expected = array('t1' => array(1, 14), 't2' => array(2, 3), 't3' => array(4, 13), 't4' => array(5, 6), 't5' => array(7, 12), 't6' => array(8, 9), 't7' => array(10, 11)); $actual = array(); foreach ($fixtures as $t) { $actual[$t->getTitle()] = array($t->getLeftValue(), $t->getRightValue()); } $this->assertEquals($actual, $expected, 'Loaded nodes are not in sync before calling updateLoadedNodes()'); \NestedSetTable9Query::updateLoadedNodes(); $expected = array('t1' => array(1, 15), 't2' => array(2, 3), 't3' => array(4, 14), 't4' => array(6, 7), 't5' => array(8, 13), 't6' => array(9, 10), 't7' => array(11, 12)); $actual = array(); foreach ($fixtures as $t) { $actual[$t->getTitle()] = array($t->getLeftValue(), $t->getRightValue()); } $this->assertEquals($actual, $expected, 'Loaded nodes are in sync after calling updateLoadedNodes()'); }
public function testUpdateLoadedNodes() { $this->assertTrue(method_exists('NestedSetTable9Query', 'updateLoadedNodes'), 'nested_set adds a updateLoadedNodes() method'); $fixtures = $this->initTree(); \NestedSetTable9Query::shiftRLValues(1, 5); $expected = ['t1' => [1, 14], 't2' => [2, 3], 't3' => [4, 13], 't4' => [5, 6], 't5' => [7, 12], 't6' => [8, 9], 't7' => [10, 11]]; $actual = []; foreach ($fixtures as $t) { $actual[$t->getTitle()] = [$t->getLeftValue(), $t->getRightValue()]; } $this->assertEquals($actual, $expected, 'Loaded nodes are not in sync before calling updateLoadedNodes()'); \NestedSetTable9Query::updateLoadedNodes(); $expected = ['t1' => [1, 15], 't2' => [2, 3], 't3' => [4, 14], 't4' => [6, 7], 't5' => [8, 13], 't6' => [9, 10], 't7' => [11, 12]]; $actual = []; foreach ($fixtures as $t) { $actual[$t->getTitle()] = [$t->getLeftValue(), $t->getRightValue()]; } $this->assertEquals($actual, $expected, 'Loaded nodes are in sync after calling updateLoadedNodes()'); }