Example #1
0
 public function init()
 {
     // Parent
     $fullClassName = get_class($this);
     $fullClassName = explode("\\", $fullClassName);
     $this->_table = strtolower($fullClassName[count($fullClassName) - 1]);
     parent::init();
     //
     $this->app = \IFR\Main\App::get();
     // PDO
     $config = getConfig(CONF_PATH . '/application.xml', getCurrentEnv());
     $config = $config->db->toArray();
     $this->_db = $this->app->getMysqlDb($config);
     // Build table
     $this->_db->exec("DROP TABLE IF EXISTS {$this->_table};");
     $filePath = sprintf('./resources/sql/%s.sql', $this->_table);
     assertTrue(file_exists($filePath), "SQL file '{$filePath}' does not exist");
     $this->_db->exec(file_get_contents($filePath));
     // Build settings
     $columns = array_merge(self::$DEFAULT_COLUMNS, $this->getColumnsDefinition());
     foreach ($columns as $name => $column) {
         $this->setColumns($name)->schemaColumnSet($name, $column);
     }
 }
Example #2
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';
require_once realpath(dirname(__DIR__)) . DIRECTORY_SEPARATOR . '_.php';
define('APPLICATION_PATH', __DIR__);
define('CONF_PATH', '/etc/IFR/Main/tests/configs');
\IFR\Main\App::get()->loadFile(CONF_PATH . '/environment.php');