public function testUnsetAliasedParent()
{
R::nuke();
$book = R::dispense('book');
$author = R::dispense('author');
$book->coauthor = $author;
R::store($book);
$book = $book->fresh();
asrt(is_null($book->fetchAs('author')->coauthor), FALSE);
unset($book->coauthor);
R::store($book);
$book = $book->fresh();
asrt(is_null($book->fetchAs('author')->coauthor), FALSE);
$book->coauthor = NULL;
R::store($book);
$book = $book->fresh();
asrt(is_null($book->fetchAs('author')->coauthor), TRUE);
R::trash($book);
R::trash($author);
R::freeze(TRUE);
$book = R::dispense('book');
$author = R::dispense('author');
$book->coauthor = $author;
R::store($book);
$book = $book->fresh();
asrt(is_null($book->fetchAs('author')->coauthor), FALSE);
unset($book->coauthor);
R::store($book);
$book = $book->fresh();
asrt(is_null($book->fetchAs('author')->coauthor), FALSE);
$book->coauthor = NULL;
R::store($book);
$book = $book->fresh();
asrt(is_null($book->fetchAs('author')->coauthor), TRUE);
R::trash($book);
R::trash($author);
R::freeze(FALSE);
}