data); } function flush() { $this->data = []; } function read($key) { return $this->data[$key]; } function write($name, $content, $expire = 43200) { return ($this->data[$name] = $content); } public static function getDisplayName(): string { return ''; } public function getStats(): array { return []; } public static function getConfig(): array { return []; } } } // SimpleORMapFake if (!class_exists('StudipTestHelper')) { class StudipTestHelper { static function set_up_tables($tables) { // first step, set fake cache $testconfig = new Config(['cache_class' => 'StudipArrayCache']); Config::set($testconfig); StudipCacheFactory::setConfig($testconfig); $GLOBALS['CACHING_ENABLE'] = true; $cache = StudipCacheFactory::getCache(false); // second step, expire table scheme SimpleORMap::expireTableScheme(); $schemes = []; foreach ($tables as $db_table) { include TEST_FIXTURES_PATH."simpleormap/$db_table.php"; $db_fields = $pk = []; foreach ($result as $rs) { $db_fields[mb_strtolower($rs['name'])] = [ 'name' => $rs['name'], 'null' => $rs['null'], 'default' => $rs['default'], 'type' => $rs['type'], 'extra' => $rs['extra'] ]; if ($rs['key'] == 'PRI'){ $pk[] = mb_strtolower($rs['name']); } } $schemes[$db_table]['db_fields'] = $db_fields; $schemes[$db_table]['pk'] = $pk; } $cache->write('DB_TABLE_SCHEMES', serialize($schemes)); } static function tear_down_tables() { SimpleORMap::expireTableScheme(); Config::set(null); StudipCacheFactory::setConfig(null); $GLOBALS['CACHING_ENABLE'] = false; } } }