box(); R::trash( $bean ); pass(); $bean = R::dispense( 'boxedbean' ); $bean->sharedBoxbean = R::dispense( 'boxedbean' )->box(); R::store( $bean ); pass(); $bean = R::dispense( 'boxedbean' ); $bean->ownBoxedbean = R::dispense( 'boxedbean' )->box(); R::store( $bean ); pass(); $bean = R::dispense( 'boxedbean' ); $bean->other = R::dispense( 'boxedbean' )->box(); R::store( $bean ); pass(); $bean = R::dispense( 'boxedbean' ); $bean->title = 'MyBean'; $box = $bean->box(); asrt( ( $box instanceof \Model_Boxedbean ), TRUE ); R::store( $box ); } /** * Test fix for issue #512 - thanks for reporting Bernhard H. * OODBBean::__toString() implementation only works with C_ERR_IGNORE * * @return void */ public function testToStringIssue512() { R::setErrorHandlingFUSE( \RedBeanPHP\OODBBean::C_ERR_FATAL ); $boxedBean = R::dispense( 'boxedbean' ); $str = (string) $boxedBean; asrt( $str, '{"id":0}' ); //no fatal error R::setErrorHandlingFUSE( FALSE ); } }