RedUNIT\Base\Prefixes::testBasicOperationsFrozen PHP Method

testBasicOperationsFrozen() public method

Test basic operations in frozen mode.
    public function testBasicOperationsFrozen()
    {
        R::nuke();
        $author = R::xdispense(AUTHOR);
        $author->name = 'Mr. Quill';
        $book = R::xdispense(BOOK);
        $book->title = 'Good Stories';
        $book2 = R::xdispense(BOOK);
        $book2->title = 'Good Stories 2';
        $friend = R::xdispense(FRIEND);
        $friend->name = 'Muse';
        $publisher = R::xdispense(PUBLISHER);
        $publisher->name = 'Good Books';
        $author->{BOOKLIST} = array($book, $book2);
        $author->{FRIENDLIST}[] = $friend;
        $author->{PUBLISHER} = $publisher;
        $coAuthor = R::xdispense(AUTHOR);
        $coAuthor->name = 'Xavier';
        $book2->{COAUTHOR} = $coAuthor;
        R::store($author);
        R::freeze(TRUE);
        asrt($author->name, 'Mr. Quill');
        asrt(count($author->{BOOKLIST}), 2);
        $firstBook = reset($author->{BOOKLIST});
        asrt($firstBook->title, 'Good Stories');
        asrt(count($author->{FRIENDLIST}), 1);
        $firstFriend = reset($author->{FRIENDLIST});
        $parent = $author->{PUBLISHER};
        asrt($parent instanceof OODBBean, TRUE);
        $tables = R::inspect();
        //have all tables been prefixed?
        foreach ($tables as $table) {
            asrt(strpos($table, 'tbl_'), 0);
        }
        //Can we make an export?
        $export = R::exportAll(R::findOne(AUTHOR), TRUE);
        $export = reset($export);
        asrt(isset($export[PUBLISHER]), TRUE);
        asrt(isset($export[BOOKLIST]), TRUE);
        asrt(isset($export[FRIENDLIST]), TRUE);
        asrt(isset($export['ownBook']), FALSE);
        asrt(isset($export['sharedFriend']), FALSE);
        asrt(isset($export['publisher']), FALSE);
        R::freeze(FALSE);
    }