public function set_up($connection_name = null) { if ($connection_name && !in_array($connection_name, PDO::getAvailableDrivers()) || ActiveRecord\Config::instance()->get_connection($connection_name) == 'skip') { $this->mark_test_skipped($connection_name . ' drivers are not present'); } parent::set_up($connection_name); }
function setUp() { parent::setUp(); $serial_string = serialize($this->db); unset($this->db); $this->db = unserialize($serial_string); }
/** * initialite */ public function setUp() { parent::setUp(); $this->_model = new Project_Models_Project(); $this->_tree = new Phprojekt_Tree_Node_Database($this->_model, 1); $this->_tree = $this->_tree->setup(); }
public function setUp($connection_name = null) { if ($connection_name && !in_array($connection_name, PDO::getAvailableDrivers())) { $this->mark_test_skipped($connection_name . ' drivers are not present'); } parent::setUp($connection_name); }
public function set_up($connection_name = null) { parent::set_up($connection_name); // ensure VenueCB model has been loaded VenueCB::find(1); $this->callback = new ActiveRecord\CallBack('VenueCB'); }
public function set_up($connection_name = null) { parent::set_up($connection_name); BookValidations::$validates_presence_of[0] = 'name'; BookValidations::$validates_uniqueness_of[0] = 'name'; ValuestoreValidations::$validates_uniqueness_of[0] = 'key'; }
public function set_up($connection_name = null) { if (!extension_loaded('memcache')) { $this->markTestSkipped('The memcache extension is not available'); return; } parent::set_up($connection_name); ActiveRecord\Config::instance()->set_cache('memcache://localhost'); }
public static function GetDatabaseConnection() { // Lazy create the singleton connection if (is_null(self::$singletonConnection)) { self::$singletonConnection = Database::connect(DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, DATABASE_HOST); } // Return the singleton connection return self::$singletonConnection; }
/** * setUp method for PHPUnit. We use a shared db connection */ public function setUp() { parent::setUp(); $this->_emptyResult = array(); $this->_formResult = array('projectId' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'title' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'notes' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'startDate' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'endDate' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'priority' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'currentStatus' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'completePercent' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'budget' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => '')); $this->_listResult = array('title' => $this->_formResult['title'], 'startDate' => $this->_formResult['startDate'], 'endDate' => $this->_formResult['endDate'], 'priority' => $this->_formResult['priority'], 'currentStatus' => $this->_formResult['currentStatus'], 'completePercent' => $this->_formResult['completePercent']); $this->_filterResult = array('title' => $this->_formResult['title'], 'start_date' => $this->_formResult['startDate'], 'end_date' => $this->_formResult['endDate'], 'priority' => $this->_formResult['priority'], 'current_status' => $this->_formResult['currentStatus'], 'complete_percent' => $this->_formResult['completePercent']); $this->sharedFixture = Phprojekt::getInstance()->getDb(); }
/** * setUp method for PHPUnit. We use a shared db connection */ public function setUp() { parent::setUp(); $this->_emptyResult = array(); $this->_formResult = array('title', 'notes', 'projectId', 'startDate', 'endDate', 'priority', 'currentStatus', 'completePercent', 'budget', 'contactId'); $this->_formLabelResult = array('Title', 'Notes', 'Parent', 'Start date', 'End date', 'Priority', 'Current status', 'Complete percent', 'Budget', 'Contact'); $this->_listResult = array('title', 'startDate', 'endDate', 'priority', 'currentStatus', 'completePercent'); $this->_listLabelResult = array('Title', 'Start date', 'End date', 'Priority', 'Current status', 'Complete percent'); $this->sharedFixture = Phprojekt::getInstance()->getDb(); }
public static function setUpBeforeClass() { @chmod(__DIR__, 0775); @mkdir(__DIR__ . '/data', 0775, true); // DON'T put this in create // create db self::$db = new Database(__DIR__ . '/data'); self::$db->guid = self::guid(); // create index self::$guidIndex = new Index(self::$db, 'guid', 'guid'); // random delay for concurrent testing usleep(rand(0, 100)); }
public function setUp($connectionName = null) { parent::setUp($connectionName); Event::$belongsTo = array(array('venue'), array('host')); Venue::$hasMany = array(array('events', 'order' => 'id asc'), array('hosts', 'through' => 'events', 'order' => 'hosts.id asc')); Venue::$hasOne = array(); Employee::$hasOne = array(array('position')); Host::$hasMany = array(array('events', 'order' => 'id asc')); foreach ($this->relationshipNames as $name) { if (preg_match("/{$name}/i", $this->getName())) { $this->relationshipName = $name; } } }
public function set_up($connection_name = null) { parent::set_up($connection_name); Event::$belongs_to = array(array('venue'), array('host')); Venue::$has_many = array(array('events', 'order' => 'id asc'), array('hosts', 'through' => 'events', 'order' => 'hosts.id asc')); Venue::$has_one = array(); Employee::$has_one = array(array('position')); Host::$has_many = array(array('events', 'order' => 'id asc')); foreach ($this->relationship_names as $name) { if (preg_match("/{$name}/", $this->getName(), $match)) { $this->relationship_name = $match[0]; } } }
public static function setUpBeforeClass() { $configuration = new DatabaseConfiguration(); $configuration->setDriver(DriverType::SQLITE); $configuration->setDatabase('test.db'); $configuration->register(); // Create a db connection and tell Phactory to use it $pdo = new SQLiteConnection(); self::$phactory = new Phactory($pdo); $pdo->exec("CREATE TABLE IF NOT EXISTS tests ( id INTEGER PRIMARY KEY, content TEXT )"); // Reset any existing blueprints and empty any tables Phactory has used self::$phactory->reset(); // Define default values for each test we will create self::$phactory->define('test', array('content' => 'Test Content $n')); }
public function setUp($connectionName = null) { parent::setUp($connectionName); BookFormat::$validatesFormatOf[0] = array('name'); }
public function set_up($connection_name = null) { parent::set_up($connection_name); BookFormat::$validates_format_of[0] = array('name'); }
public function set_up($connection_name = null) { parent::set_up($connection_name); $this->sql = new SQLBuilder($this->conn, $this->table_name); $this->table = Table::load($this->class_name); }
public function set_up($connection_name = null) { parent::set_up($connection_name); BookNumericality::$validates_numericality_of = array(array('numeric_test')); }
public function set_up($connection_name = null) { parent::set_up($connection_name); BookValidations::$validates_uniqueness_of[0] = array('name'); }
public function set_up($connection_name = null) { parent::set_up($connection_name); $this->venue = new Venue(); $this->callback = Venue::table()->callback; }
public function set_up($connection_name = null) { parent::set_up($connection_name); BookLength::$validates_length_of[0] = array('name', 'allow_blank' => false, 'allow_null' => false); }
public function tear_down() { parent::tear_down(); ActiveRecord\ArraySerializer::$include_root = false; ActiveRecord\JsonSerializer::$include_root = false; }
public function set_up($connection_name = null) { parent::set_up($connection_name); $this->options = array('conditions' => 'blah', 'order' => 'blah'); }
public function setUp($connectionName = null) { parent::setUp($connectionName); BookLength::$validatesLengthOf[0] = array('name', 'allowBlank' => false, 'allowNull' => false); }
/** * This method is called before the first test of this test class is run. * * @since Method available since Release 3.4.0 */ public static function setUpBeforeClass() { self::$config = json_decode(file_get_contents(dirname(__DIR__) . '/config.test.json'), true); }
/** * setUp method for PHPUnit */ public function setUp() { parent::setUp(); $this->_model = new Timecard_Models_Timecard(); }
public function setUp() { parent::setUp(); $this->sharedFixture = Phprojekt::getInstance()->getDb(); }
public function setUp() { parent::setUp(); $this->pdo = new \Cactus\Adapter\PDO($this->pdo = $this->getConnection()->getConnection()); }
} ActiveRecord\Config::initialize(function ($cfg) { $cfg->set_model_directory(realpath(__DIR__ . '/../models')); $cfg->set_connections(array('mysql' => getenv('PHPAR_MYSQL') ?: 'mysql://*****:*****@127.0.0.1/test', 'pgsql' => getenv('PHPAR_PGSQL') ?: 'pgsql://*****:*****@127.0.0.1/test', 'oci' => getenv('PHPAR_OCI') ?: 'oci://*****:*****@127.0.0.1/dev', 'sqlite' => getenv('PHPAR_SQLITE') ?: 'sqlite://test.db')); $cfg->set_default_connection('mysql'); for ($i = 0; $i < count($GLOBALS['argv']); ++$i) { if ($GLOBALS['argv'][$i] == '--adapter') { $cfg->set_default_connection($GLOBALS['argv'][$i + 1]); } elseif ($GLOBALS['argv'][$i] == '--slow-tests') { $GLOBALS['slow_tests'] = true; } } if (class_exists('Log_file')) { $logger = new Log_file(dirname(__FILE__) . '/../log/query.log', 'ident', array('mode' => 0664, 'timeFormat' => '%Y-%m-%d %H:%M:%S')); $cfg->set_logging(true); $cfg->set_logger($logger); } else { if ($GLOBALS['show_warnings'] && !isset($GLOBALS['show_warnings_done'])) { echo "(Logging SQL queries disabled, PEAR::Log not found.)\n"; } DatabaseTest::$log = false; } if ($GLOBALS['show_warnings'] && !isset($GLOBALS['show_warnings_done'])) { if (!extension_loaded('memcache')) { echo "(Cache Tests will be skipped, Memcache not found.)\n"; } } date_default_timezone_set('UTC'); $GLOBALS['show_warnings_done'] = true; }); error_reporting(E_ALL | E_STRICT);
public function set_up($connection_name = null) { parent::set_up($connection_name); BookInclusion::$validates_inclusion_of[0] = array('name', 'in' => array('blah', 'tanker', 'shark')); BookExclusion::$validates_exclusion_of[0] = array('name', 'in' => array('blah', 'alpha', 'bravo')); }