public function testSelfRefNM()
{
R::nuke();
$friend1 = R::xdispense(FRIEND);
$friend1->name = 'f1';
$friend2 = R::xdispense(FRIEND);
$friend2->name = 'f2';
$friend3 = R::xdispense(FRIEND);
$friend3->name = 'f3';
$friend1->{FRIENDLIST} = array($friend2, $friend3);
$friend3->{FRIENDLIST} = array($friend1);
R::storeAll(array($friend1, $friend2, $friend3));
$friend1 = $friend1->fresh();
$friend2 = $friend2->fresh();
$friend3 = $friend3->fresh();
asrt(count($friend1->{FRIENDLIST}), 2);
asrt(count($friend2->{FRIENDLIST}), 1);
asrt(count($friend3->{FRIENDLIST}), 1);
$friend = reset($friend3->{FRIENDLIST});
asrt($friend->name, 'f1');
}