/** * Behaviour to adopt when an instancer of Switcher is destroyed by PHP. * * @access public */ public function __destruct() { ClassProxy::$ressourcesDelegatedTo = array(); ResourceProxy::$ressourcesDelegatedTo = array(); PropertyProxy::$ressourcesDelegatedTo = array(); }
/** * Clears the caches without immediately recalculating them * * @access public * @author Joel Bout, <*****@*****.**> * @return mixed */ public function clearCaches() { self::$_properties = null; self::$_classes = null; self::$_resources = array(); self::$_resources_loaded = false; ClassProxy::$ressourcesDelegatedTo = array(); ResourceProxy::$ressourcesDelegatedTo = array(); PropertyProxy::$ressourcesDelegatedTo = array(); // remove hard-api-property cache. $cache = \common_cache_FileCache::singleton(); $cache->remove('hard-api-property'); }
public function testForceMode() { $this->hardify(); // Check if the returner implementation are correct PersistenceProxy::forceMode(PERSISTENCE_SMOOTH); $classProxy = ClassProxy::singleton(); $impl = $classProxy->getImpToDelegateTo($this->targetSubjectClass); $this->assertTrue($impl instanceof core_kernel_persistence_smoothsql_Class); $this->assertEquals(count($this->targetSubjectClass->getInstances()), 1); $this->assertEquals(count($this->targetSubjectSubClass->getInstances()), 1); PersistenceProxy::restoreImplementation(); $this->assertTrue(ClassProxy::singleton()->getImpToDelegateTo($this->targetSubjectClass) instanceof Clazz); $this->assertTrue(ResourceProxy::singleton()->getImpToDelegateTo($this->subject1) instanceof Resource); }