Example #1
0
    pass();
}
//Test the Check() function (also indirectly using store())
testpack("UNIT TEST RedBean OODB: Check");
$bean = $redbean->dispense("page");
//Set some illegal values in the bean; this should trugger Security exceptions.
//Arrays are not allowed.
$bean->name = array("1");
try {
    $redbean->store($bean);
    fail();
} catch (RedBean_Exception_Security $e) {
    pass();
}
try {
    $redbean->check($bean);
    fail();
} catch (RedBean_Exception_Security $e) {
    pass();
}
//Objects should not be allowed.
$bean->name = new RedBean_OODBBean();
try {
    $redbean->store($bean);
    fail();
} catch (RedBean_Exception_Security $e) {
    pass();
}
try {
    $redbean->check($bean);
    fail();