RedUNIT\Blackhole\Toolbox::testRepoSwitching PHP Method

testRepoSwitching() public method

Tests whether freeze() switches the repository object as it is supposed to do.
public testRepoSwitching ( ) : void
return void
    public function testRepoSwitching()
    {
        asrt(class_exists('RedBeanPHP\\Repository'), TRUE);
        asrt(class_exists('RedBeanPHP\\Repository\\Fluid'), TRUE);
        asrt(class_exists('RedBeanPHP\\Repository\\Frozen'), TRUE);
        R::freeze(FALSE);
        $redbean = R::getRedBean();
        $repo = $redbean->getCurrentRepository();
        asrt(is_object($repo), TRUE);
        asrt($repo instanceof Repository, TRUE);
        asrt($repo instanceof FluidRepo, TRUE);
        R::freeze(TRUE);
        $fluid = $repo;
        $repo = $redbean->getCurrentRepository();
        asrt(is_object($repo), TRUE);
        asrt($repo instanceof Repository, TRUE);
        asrt($repo instanceof FrozenRepo, TRUE);
        $frozen = $repo;
        R::freeze(FALSE);
        $redbean = R::getRedBean();
        $repo = $redbean->getCurrentRepository();
        asrt(is_object($repo), TRUE);
        asrt($repo instanceof Repository, TRUE);
        asrt($repo instanceof FluidRepo, TRUE);
        asrt($repo, $fluid);
        R::freeze(TRUE);
        $fluid = $repo;
        $repo = $redbean->getCurrentRepository();
        asrt(is_object($repo), TRUE);
        asrt($repo instanceof Repository, TRUE);
        asrt($repo instanceof FrozenRepo, TRUE);
        asrt($repo, $frozen);
        R::freeze(FALSE);
    }