public function setUp() { $this->db = dirname(__FILE__) . '/test.db'; $this->adapter = new ActivePhp\Sqlite3Adapter(array('file' => $this->db)); ActivePhp\Base::$class = 'Test'; $this->adapter->query('CREATE TABLE IF NOT EXISTS foo (id INTEGER PRIMARY KEY, bar STRING)'); }
public static function columns($table) { $sql = 'SHOW COLUMNS FROM ' . static::quote_table_name($table); $result = ActivePhp\Base::execute($sql, true); $output = array(); while ($row = mysql_fetch_assoc($result)) { array_push($output, $row); } return $output; }
public function tearDown() { User::end_transaction(); ActivePhp\Base::$test_mode = false; }
public function setUp() { ActivePhp\Base::$adapter = new ActivePhp\MysqlAdapter(array('host' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'active_php_test')); $this->adapter = ActivePhp\Base::$adapter; ActivePhp\Base::$class = 'Test'; }
public function tearDown() { ActivePhp\Base::$test_mode = false; }
<?php require_once dirname(__FILE__) . '/../../active_support/inflector.php'; require_once dirname(__FILE__) . '/../../base.php'; define('MYSQL_DATABASE', 'active_php_test'); define('DATABASE_HOST', 'localhost'); ActivePhp\Base::establish_connection(array('host' => DATABASE_HOST, 'database' => MYSQL_DATABASE, 'username' => 'root', 'password' => '', 'file' => dirname(__FILE__) . '/test.db', 'adapter' => 'mysql'));
<?php ActivePhp\Base::establish_connection(array('host' => 'localhost', 'database' => 'test_php', 'username' => 'root', 'password' => ''));