RedUNIT\Base\Misc::testCheckDirectly PHP Method

testCheckDirectly() public method

Normally the check() method is always called indirectly when dealing with beans. This test ensures we can call check() directly. Even though frozen repositories do not rely on bean checking to improve performance the method should still offer the same functionality when called directly.
public testCheckDirectly ( ) : void
return void
    public function testCheckDirectly()
    {
        $bean = new OODBBean();
        $bean->id = 0;
        $bean->setMeta('type', 'book');
        R::getRedBean()->check($bean);
        $bean->setMeta('type', '.');
        try {
            R::getRedBean()->check($bean);
            fail();
        } catch (\Exception $e) {
            pass();
        }
        //check should remain the same even if frozen repo is used, method is public after all!
        //we dont want to break the API!
        R::freeze(TRUE);
        try {
            R::getRedBean()->check($bean);
            fail();
        } catch (\Exception $e) {
            pass();
        }
        R::freeze(FALSE);
    }