getToolbox(); asrt( ( $toolbox2 instanceof TB), TRUE ); asrt( $toolbox, $toolbox2 ); $extractedToolbox = $beanHelper->getExtractedToolbox(); asrt( is_array( $extractedToolbox ), TRUE ); asrt( count( $extractedToolbox ), 4 ); asrt( ( $extractedToolbox[0] instanceof OODB ), TRUE ); asrt( ( $extractedToolbox[1] instanceof Adapter ), TRUE ); asrt( ( $extractedToolbox[2] instanceof QueryWriter ), TRUE ); asrt( ( $extractedToolbox[3] instanceof TB ), TRUE ); } /** * Does the toolbox contain the necessary tools ? * * @return void */ public function testDoesToolboxContainTheTools() { $toolbox = R::getToolBox(); asrt( ( $toolbox->getDatabaseAdapter() instanceof Adapter ), TRUE ); asrt( ( $toolbox->getRedBean() instanceof OODB ), TRUE ); asrt( ( $toolbox->getWriter() instanceof QueryWriter ), TRUE ); } /** * Tests whether freeze() switches the repository object * as it is supposed to do. * * @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 ); } }