RedUNIT\Base\Writecache::testExplicitCacheFlush PHP Method

testExplicitCacheFlush() public method

Test explicit flush.
public testExplicitCacheFlush ( ) : void
return void
    public function testExplicitCacheFlush()
    {
        testpack('Test cache flush (explicit)');
        R::setNarrowFieldMode(FALSE);
        R::debug(true, 1);
        $logger = R::getDatabaseAdapter()->getDatabase()->getLogger();
        $bean = R::dispense('bean');
        $bean->title = 'abc';
        $id1 = R::store($bean);
        $logger->clear();
        $bean = R::load('bean', $id1);
        asrt($bean->title, 'abc');
        asrt(count($logger->grep('SELECT *')), 1);
        $bean = R::load('bean', $id1);
        asrt(count($logger->grep('SELECT *')), 1);
        R::getWriter()->flushCache();
        $bean = R::load('bean', $id1);
        asrt(count($logger->grep('SELECT *')), 2);
        R::getWriter()->flushCache();
        R::getWriter()->setUseCache(FALSE);
        R::setNarrowFieldMode(TRUE);
    }