public function testDataIntegrity()
 {
     $this->dataIntegrity['statements1'] = $this->countStatements();
     $this->dataIntegrity['subSubjectClassCount1'] = $this->targetSubjectClass->countInstances();
     $this->dataIntegrity['subSubSubjectClassCount1'] = $this->targetSubjectSubClass->countInstances();
     $this->assertEquals($this->dataIntegrity['statements0'], $this->dataIntegrity['statements1']);
     $this->assertEquals($this->dataIntegrity['subSubjectClassCount0'], $this->dataIntegrity['subSubjectClassCount1']);
     $this->assertEquals($this->dataIntegrity['subSubSubjectClassCount0'], $this->dataIntegrity['subSubSubjectClassCount1']);
     $this->assertFalse(ClassProxy::singleton()->isValidContext('hardsql', $this->targetSubjectClass));
     $this->assertTrue(ClassProxy::singleton()->isValidContext('smoothsql', $this->targetSubjectClass));
     $this->assertIsA(ClassProxy::singleton()->getImpToDelegateTo($this->targetSubjectClass), 'core_kernel_persistence_smoothsql_Class');
     $this->assertFalse(ClassProxy::singleton()->isValidContext('hardsql', $this->targetSubjectSubClass));
     $this->assertTrue(ClassProxy::singleton()->isValidContext('smoothsql', $this->targetSubjectSubClass));
     $this->assertIsA(ClassProxy::singleton()->getImpToDelegateTo($this->targetSubjectSubClass), 'core_kernel_persistence_smoothsql_Class');
 }
 /**
  * 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);
 }