RedUNIT\Base\Dup::testKeepOldID PHP Method

testKeepOldID() public method

Tests whether the original ID is stored in meta data (quite handy for ID mappings).
public testKeepOldID ( )
    public function testKeepOldID()
    {
        R::nuke();
        $book = R::dispense('book');
        $book->xownPageList[] = R::dispense('page');
        R::store($book);
        $bookID = $book->id;
        $page = reset($book->xownPageList);
        $pageID = $page->id;
        $book = $book->fresh();
        $copy = R::duplicate($book);
        asrt($copy->getMeta('sys.dup-from-id'), $bookID);
        $copyPage = reset($copy->xownPageList);
        asrt($copyPage->getMeta('sys.dup-from-id'), $pageID);
    }