public function testPointersToNodesAreNotLost() { $actual = array(new SimpleDOM('<child letter="c" />'), new SimpleDOM('<child letter="d" />'), new SimpleDOM('<child letter="e" />'), new SimpleDOM('<child letter="a" />'), new SimpleDOM('<child letter="b" />')); $c = $actual[0]; $d = $actual[1]; $e = $actual[2]; $a = $actual[3]; $b = $actual[4]; SimpleDOM::sort($actual, '@letter'); $a['old_letter'] = 'a'; $b['old_letter'] = 'b'; $c['old_letter'] = 'c'; $d['old_letter'] = 'd'; $e['old_letter'] = 'e'; $expected = array(new SimpleDOM('<child letter="a" old_letter="a" />'), new SimpleDOM('<child letter="b" old_letter="b" />'), new SimpleDOM('<child letter="c" old_letter="c" />'), new SimpleDOM('<child letter="d" old_letter="d" />'), new SimpleDOM('<child letter="e" old_letter="e" />')); $this->assertEquals($expected, $actual); }