public function basic()
{
$book = R::dispense('book');
asrt(isset($book->prop), FALSE);
//not a very good test
asrt(in_array('prop', array_keys($book->export())), FALSE);
//better...
$book = R::dispense('book');
$page = R::dispense('page');
$book->paper = $page;
$id = R::store($book);
$book = R::load('book', $id);
asrt(FALSE, isset($book->paper));
asrt(FALSE, isset($book->page));
/**
* The following tests try to store various things that aren't
* beans (which is expected) with the own* and shared* properties
* which only accept beans as assignments, so they're expected to fail
*/
foreach (array('a string', 1928, TRUE, NULL, array()) as $value) {
try {
$book->ownPage[] = $value;
R::store($book);
$book->sharedPage[] = $value;
R::store($book);
fail();
} catch (RedException $e) {
pass();
} catch (\Exception $e) {
fail();
}
}
}