function setUp() { if (null === $this->pdo) { $this->pdo = new PDO("mysql:host=localhost;dbname=test", "root"); ActiveRecord::setConnection($this->pdo); ActiveRecord::setFetchModeClass(); } $this->pdo->query("DROP TABLE activerecordtest"); $this->pdo->query("CREATE TABLE activerecordtest (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, \n\t\t\tname VARCHAR(255))"); }
/** * @return PDO */ static function getConnection() { if (null === static::$connection) { ActiveRecord::setConnection(\Naf::pdo()); } return static::$connection; }