public function setUp($connectionName = null) { ActiveRecord\Table::clearCache(); $config = ActiveRecord\Config::instance(); $this->originalDefaultConnection = $config->getDefaultConnection(); if ($connectionName) { $config->setDefaultConnection($connectionName); } if ($connectionName == 'sqlite' || $config->getDefaultConnection() == 'sqlite') { // need to create the db. the adapter specifically does not create it for us. $this->db = substr(ActiveRecord\Config::instance()->getConnection('sqlite'), 9); new SQLite3($this->db); } $this->connectionName = $connectionName; $this->conn = ActiveRecord\ConnectionManager::getConnection($connectionName); $GLOBALS['ACTIVERECORD_LOG'] = false; $loader = new DatabaseLoader($this->conn); $loader->resetTableData(); if (self::$log) { $GLOBALS['ACTIVERECORD_LOG'] = true; } }
public function testSubstituteEscapeQuotesWithConnectionsEscapeMethod() { $conn = ActiveRecord\ConnectionManager::getConnection(); $a = new Expressions(null, 'name=?', "Tito's Guild"); $a->setConnection($conn); $escaped = $conn->escape("Tito's Guild"); $this->assertEquals("name={$escaped}", $a->toS(true)); }
public function setUp() { $this->column = new Column(); $this->conn = ActiveRecord\ConnectionManager::getConnection(ActiveRecord\Config::instance()->getDefaultConnection()); }