/** * Run when initializing * * @return null */ public static function setUpBeforeClass() { $file = realpath(dirname(__FILE__) . "/../database/test.sqlite3"); self::$con = new PDO("sqlite:{$file}"); // self::$con = new PDO('mysql:host=localhost;dbname=torm',"torm","torm"); TORM\Connection::setConnection(self::$con, "test"); TORM\Connection::setEncoding("UTF-8"); TORM\Connection::setDriver("sqlite"); TORM\Factory::setFactoriesPath("./factories"); TORM\Log::enable(false); TORM\Cache::getInstance()->setTimeout(300); }
/** * Run when initializing * * @return null */ public static function setUpBeforeClass() { $file = realpath(dirname(__FILE__) . "/../database/test.sqlite3"); self::$con = new PDO("sqlite:{$file}"); // self::$con = new PDO('mysql:host=localhost;dbname=torm',"torm","torm"); TORM\Connection::setConnection(self::$con, "test"); TORM\Connection::setEncoding("UTF-8"); TORM\Connection::setDriver("sqlite"); // TORM\Connection::setDriver("mysql"); TORM\Factory::setFactoriesPath("./factories"); TORM\Log::enable(false); self::_deleteAll(); self::$user = new ElasticUser(); self::$user->id = 1; self::$user->name = "John Doe Jr."; self::$user->email = "*****@*****.**"; self::$user->code = "12345"; self::$user->level = 1; self::$user->save(); ElasticUser::refreshElastic(); ElasticUser::setElasticSearchIndex("torm"); ElasticUser::setElasticSearchValues(null); }
<?php require 'vendor/autoload.php'; $con = new PDO("sqlite:db/database.sqlite3"); TORM\Connection::setConnection($con); TORM\Connection::setDriver("sqlite"); $app = new \Framework\Initializer(); if (getenv('BIRDS_ENV') == 'development') { $app->public_folder = dirname(__FILE__) . '/public/'; } else { \Framework\Application::$url_prefix = '/projetos/gaia-pdti/index.php'; if ($_SERVER['REQUEST_URI'] == '/projetos/gaia-pdti/') { header('Location: ' . \Framework\Application::$url_prefix); } } $app->run($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
/** * Test connection * * @return null */ public function testConnection() { $this->assertNotNull(self::$con); $this->assertEquals(self::$con, TORM\Connection::getConnection("test")); }