spl_autoload_register(function ($className) { if (substr($className, 0, 4) === 'Spot') { $filename = str_replace(array('\\', '_'), DIRECTORY_SEPARATOR, trim($className, '\\_')) . '.php'; require_once $filename; } }); // Setup cache manager #$cache = new \CacheCache\Cache(new \CacheCache\Backends\Dummy()); #$cacheManager = new \CacheCache\CacheManager(); #$cacheManager->set('cacheDummy', $cache); // Setup available adapters for testing $options = array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_CASE => \PDO::CASE_LOWER, \PDO::ATTR_PERSISTENT => true); $db = new \Pdo('mysql:host=localhost;dbname=test', 'test', 'test', $options); #$db = new \Pdo('sqlite::memory:', $options); // Setup config $cfg = \Spot\Config::getInstance(true); $adapter = new \Spot\Adapter\Mysql($db); $adapter->database('test'); $cfg->addConnection('db', $adapter); // Return Spot mapper for use $mapper = new \Spot\Mapper($cfg); function test_spot_mapper() { global $mapper; return $mapper; } /** * Debug function, dont die after output */ function d() {
public function testConfigCanUnserialize() { $cfg = \Spot\Config::getInstance(true); $adapter = $cfg->addConnection('test_adapter', new \Spot\Adapter\Mock()); $this->assertInstanceOf('\\Spot\\Config', unserialize(serialize($cfg))); }