public function testDupAndExportNonTainting()
{
testpack('Dup() and Export() should not taint beans');
$p = R::dispense('page');
$b = R::dispense('book');
$b->ownPage[] = $p;
$b->title = 'a';
$id = R::store($b);
$b = R::load('book', $id);
asrt(!$b->getMeta('tainted'), TRUE);
R::exportAll($b);
asrt(!$b->getMeta('tainted'), TRUE);
R::dup($b);
asrt(!$b->getMeta('tainted'), TRUE);
testpack('Test issue with ownItems and stealing Ids.');
R::nuke();
$bill = R::dispense('bill');
$item = R::dispense('item');
$element = R::dispense('element');
$bill->ownItem[] = $item;
$bill->sharedElement[] = $element;
R::store($bill);
$bill = R::load('bill', 1);
$bill->ownItem;
$bill->sharedElement;
$copy = R::dup($bill);
R::store($copy);
$rows = R::getAll('select * from bill_element');
asrt(count($rows), 2);
$rows = R::getAll('select * from item');
foreach ($rows as $row) {
asrt($row['bill_id'] > 0, TRUE);
}
R::nuke();
$this->runOnce();
R::freeze(TRUE);
$this->runOnce(FALSE);
R::freeze(FALSE);
}