/** * Assert some tables with data into the database before we start testing * */ public static function setUpBeforeClass() { parent::setUpBeforeClass(); $queries = array('DROP TABLE IF EXISTS `test_users`;', 'DROP TABLE IF EXISTS `test_names`;', 'DROP TABLE IF EXISTS `test_tags`;', 'DROP TABLE IF EXISTS `test_tags_test_users` ;', 'CREATE TABLE `test_users` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `title` VARCHAR(20), `year` INT, `joined` INT, `last_online` INT, `last_breathed` TIMESTAMP )', 'CREATE TABLE `test_names` ( `test_user_id` INT PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(20) )', 'CREATE TABLE `test_tags` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(20) )', 'CREATE TABLE `test_tags_test_users` ( `test_user_id` INT, `test_tag_id` INT )', "INSERT INTO `test_users` VALUES\n\t\t\t\t(1, 'Mr' , 1991, 1, 10, FROM_UNIXTIME(10)),\n\t\t\t\t(2, 'Mrs', 1992, 3, 12, FROM_UNIXTIME(12)),\n\t\t\t\t(3, 'Dr' , 1993, 5, 15, FROM_UNIXTIME(15)),\n\t\t\t\t(4, 'Ms' , 1994, 5, 15, FROM_UNIXTIME(20))", "INSERT INTO `test_names` VALUES (1, 'one'), (2, 'two'), (3, 'three')", "INSERT INTO `test_tags` VALUES (1, 'abc'), (2, 'def'), (3, 'ghi'), (9, '01234')", 'INSERT INTO `test_tags_test_users` VALUES (1,1), (2,2), (3,3), (1,2), (1,3), (2,1), (2,3)'); $db = Database::instance(); $db->connect(); foreach ($queries as $query) { $result = mysql_query($query); if ($result === FALSE) { throw new Exception(mysql_error()); } } }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$_oldLogActive = Mage::app()->getStore()->getConfig('dev/log/active'); self::$_oldExceptionFile = Mage::app()->getStore()->getConfig('dev/log/exception_file'); self::$_oldWriterModel = (string) Mage::getConfig()->getNode('global/log/core/writer_model'); }
public static function setUpBeforeClass() { // inject definitions to avoid database usage $yml = file_get_contents(PIWIK_PATH_TEST_TO_ROOT . SearchEngine::DEFINITION_FILE); SearchEngine::getInstance()->loadYmlData($yml); parent::setUpBeforeClass(); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$testConfig = TestConfig::createDefaultConfig(); self::$wpAutomation = new WpAutomation(self::$testConfig->testSite, self::$testConfig->wpCliVersion); self::setUpSite(); DBAsserter::assertFilesEqualDatabase(); $yamlDir = self::$wpAutomation->getPluginsDir() . '/versionpress/.versionpress'; $schemaFile = $yamlDir . '/schema.yml'; $actionsFile = $yamlDir . '/actions.yml'; $shortcodeFile = $yamlDir . '/shortcodes.yml'; /** @var $wp_db_version */ require self::$wpAutomation->getAbspath() . '/wp-includes/version.php'; if (!function_exists('get_shortcode_regex')) { require_once self::$wpAutomation->getAbspath() . '/wp-includes/shortcodes.php'; } self::$schemaInfo = new DbSchemaInfo([$schemaFile], self::$testConfig->testSite->dbTablePrefix, $wp_db_version); $actionsInfoProvider = new ActionsInfoProvider([$actionsFile]); $changeInfoFactory = new ChangeInfoFactory(self::$schemaInfo, $actionsInfoProvider); $dbHost = self::$testConfig->testSite->dbHost; $dbUser = self::$testConfig->testSite->dbUser; $dbPassword = self::$testConfig->testSite->dbPassword; $dbName = self::$testConfig->testSite->dbName; $wpdb = new wpdb($dbUser, $dbPassword, $dbName, $dbHost); $wpdb->set_prefix(self::$testConfig->testSite->dbTablePrefix); self::$database = new Database($wpdb); $shortcodesInfo = new ShortcodesInfo([$shortcodeFile]); self::$vpidRepository = new VpidRepository(self::$database, self::$schemaInfo); self::$shortcodesReplacer = new ShortcodesReplacer($shortcodesInfo, self::$vpidRepository); $vpdbPath = self::$wpAutomation->getVpdbDir(); self::$tableSchemaRepository = new TableSchemaStorage(self::$database, $vpdbPath . '/.schema'); self::$storageFactory = new StorageFactory($vpdbPath, self::$schemaInfo, self::$database, [], $changeInfoFactory, self::$tableSchemaRepository); self::$urlReplacer = new AbsoluteUrlReplacer(self::$testConfig->testSite->url); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); $method = "PUT"; $url = "http://10.232.42.205/test"; curl_setopt(self::$ch, CURLOPT_URL, $url); curl_setopt(self::$ch, CURLOPT_PORT, 9200); curl_setopt(self::$ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt(self::$ch, CURLOPT_CUSTOMREQUEST, strtoupper($method)); $result = curl_exec(self::$ch); $url = "http://10.232.42.205/test1"; curl_setopt(self::$ch, CURLOPT_URL, $url); $result = curl_exec(self::$ch); $method = "PUT"; $url = "http://10.232.42.205/test/index/_mapping"; $map = '{ "index" : { "properties" : { "message" : {"type" : "string", "store" : "yes"} }, "_timestamp" : { "enabled" : true }, "_ttl" : { "enabled" : true } } }'; curl_setopt(self::$ch, CURLOPT_URL, $url); curl_setopt(self::$ch, CURLOPT_PORT, 9200); curl_setopt(self::$ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt(self::$ch, CURLOPT_CUSTOMREQUEST, strtoupper($method)); curl_setopt(self::$ch, CURLOPT_POSTFIELDS, $map); $result = curl_exec(self::$ch); }
public static function setUpBeforeClass() { CRM_Core_Config::singleton(1, 1); CRM_Utils_System::loadBootStrap(array('name' => $GLOBALS['_CV']['ADMIN_USER'], 'pass' => $GLOBALS['_CV']['ADMIN_PASS'])); CRM_Utils_System::synchronizeUsers(); parent::setUpBeforeClass(); }
/** * Set up the system by ensuring some files aren't there. * * @return void * * @since 12.3 */ public static function setUpBeforeClass() { // Clean up files @unlink(__DIR__ . '/data/web-keychain.dat'); @unlink(__DIR__ . '/data/web-passphrase.dat'); parent::setUpBeforeClass(); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); global $freeze; if ($freeze) { $schemaFile = sys_get_temp_dir() . '/autobuilt.sql'; $success = preg_match("/;dbname=([^;]+)/", Yii::app()->db->connectionString, $matches); // Not Coding Standard assert('$success == 1'); // Not Coding Standard $databaseName = $matches[1]; if (file_exists($schemaFile) && filesize($schemaFile) > 0) { system('mysql -u' . Yii::app()->db->username . ' -p' . Yii::app()->db->password . ' ' . $databaseName . " < {$schemaFile}"); } } RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password); assert('RedBeanDatabase::isSetup()'); // Not Coding Standard GeneralCache::forgetAll(); if ($freeze) { RedBeanDatabase::freeze(); TestDatabaseUtil::deleteRowsFromAllTablesExceptLog(); } else { TestDatabaseUtil::deleteAllTablesExceptLog(); } Yii::app()->user->userModel = null; Yii::app()->user->clearStates(); //reset session. Yii::app()->language = Yii::app()->getConfigLanguageValue(); Yii::app()->timeZoneHelper->setTimeZone(Yii::app()->getConfigTimeZoneValue()); Yii::app()->timeZoneHelper->load(); //resets timezone Yii::app()->languageHelper->flushModuleLabelTranslationParameters(); }
public static function setUpBeforeClass() { global $CFG; parent::setUpBeforeClass(); if (!defined('PHPUNIT_TEST_DRIVER')) { // use normal $DB return; } if (!isset($CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER])) { throw new exception('Can not find driver configuration options with index: ' . PHPUNIT_TEST_DRIVER); } $dblibrary = empty($CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dblibrary']) ? 'native' : $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dblibrary']; $dbtype = $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dbtype']; $dbhost = $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dbhost']; $dbname = $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dbname']; $dbuser = $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dbuser']; $dbpass = $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dbpass']; $prefix = $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['prefix']; $dboptions = empty($CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dboptions']) ? array() : $CFG->phpunit_extra_drivers[PHPUNIT_TEST_DRIVER]['dboptions']; $classname = "{$dbtype}_{$dblibrary}_moodle_database"; require_once "{$CFG->libdir}/dml/{$classname}.php"; $d = new $classname(); if (!$d->driver_installed()) { throw new exception('Database driver for ' . $classname . ' is not installed'); } $d->connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions); self::$extradb = $d; }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); log_message(LOG_DEBUG, "start up the log", \Utils\UtilFactory::getLogHandle()); set_exception_handler("_exception_handle"); register_shutdown_function("_finish_handle"); }
public static function setUpBeforeClass() { self::$entityManager = GetEntityManager(); // Build the schema for sqlite self::generateSchema(); $newCustomer = new Customer(); $newCustomer->setActive(true); $newCustomer->setName('Name 1'); self::$entityManager->persist($newCustomer); $newPost = new Post(); $newPost->setCustomer($newCustomer); $newPost->setDate(new \DateTime('2016-07-12 16:30:12.000000')); $newPost->setDescription('Description test'); self::$entityManager->persist($newPost); $newComment = new Comment(); $newComment->setPost($newPost); $newComment->setComment('Comment 1'); self::$entityManager->persist($newComment); $newComment2 = new Comment(); $newComment2->setPost($newPost); $newComment2->setComment('Comment 2'); $newComment2->setParentComment($newComment); self::$entityManager->persist($newComment2); self::$entityManager->flush(); self::$classConfig = [CustomerMapping::class, PostMapping::class, CommentMapping::class]; parent::setUpBeforeClass(); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); if (!is_object(self::$client)) { self::$client = new Client(); } }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); $CI =& get_instance(); $CI->load->library('Twig'); $CI->load->helper('url_helper'); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$_JANUARY_01_1971_09_00_00 = mktime(9, 00, 00, 1, 1, 1971); self::$_JANUARY_01_1971_09_10_00 = mktime(9, 10, 00, 1, 1, 1971); self::$_JANUARY_01_1971_10_00_00 = mktime(10, 00, 00, 1, 1, 1971); }
/** * @inheritdoc */ public static function setUpBeforeClass() { parent::setUpBeforeClass(); foreach (self::$uuids as $i => $uuid) { self::$uuids[$i] = Uuid::fromString($uuid); } }
public static function setUpBeforeClass() { self::$debug = false; self::checkTablesAreEmpty(); self::$datasetRegistryTestClass = new DatasetRegistry(); parent::setUpBeforeClass(); }
public function setUp() { parent::setUp(); $this->options = array('date' => array('dateFormat' => 'dd-MM-yyyy', 'description' => 'dd-mm-yyyy', 'size' => 10, 'jQueryParams' => array('buttonImage' => 'datepicker.png', 'changeMonth' => true, 'changeYear' => true, 'duration' => 'fast', 'showOn' => 'button'))); MUtil_Model_Bridge_FormBridge::setFixedOptions($this->options); parent::setUpBeforeClass(); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); //cache anything in the StableUpdate log to restore after if (file_exists(__DIR__ . '/../../Includes/StableUpdate.log')) { self::$logContents = file_get_contents(__DIR__ . '/../../Includes/StableUpdate.log'); } }
/** * This method is called before the first test of this test class is run. */ public static function setUpBeforeClass() { parent::setUpBeforeClass(); if (empty(self::$aerospike) || !self::$aerospike->isConnected()) { self::$aerospike = new Aerospike(['hosts' => [['addr' => 'localhost', 'port' => 3000]]]); self::$store = new AerospikeStore(self::$aerospike); } }
protected function setUp() { parent::setUpBeforeClass(); $container = DI::get()->container(); DIBuilder::setupConfig($container); DIBuilder::setupUsers($container); $container->add('db', null); }
public static function setUpBeforeClass() { if (self::$comparators === null) { self::$comparators = array(new DoctrineCollectionComparator()); array_map(array(Factory::getInstance(), 'register'), self::$comparators); } parent::setUpBeforeClass(); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); $di = new \Phalcon\DI\FactoryDefault(); $config = new \Phalcon\Config(require APP_ROOT . '/app/config/config.php'); self::$application = new \Vegas\Mvc\Application($di, $config); self::$application->bootstrap(); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // Add version check to prevent fatals if (PHP_VERSION_ID >= 50600) { self::$invocationClass = MethodInvocationComposer::compose(false, true, true, false); } }
public function setUp() { parent::setUp(); parent::setUpBeforeClass(); //$this->saveFactoryState(); $this->setUpLdapConfigFiles(); SHFactory::$config = null; }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // TODO: Change the autogenerated stub self::$tmpDir = sys_get_temp_dir() . '/phpguard-test'; if (!is_dir(self::$tmpDir)) { mkdir(self::$tmpDir, 0755, true); } }
/** * set up eloquent for test */ public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$manager = new Manager(); // TODO: add dotenv and extract for reuse self::$manager->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'grimm', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null]); self::$manager->setAsGlobal(); self::$manager->bootEloquent(); }
public static function setUpBeforeClass() { echo ".................................CommandTest...............................\n"; parent::setUpBeforeClass(); ControlResolver::setAppPath(dirname(__FILE__) . '/'); self::$_APP_CTRL = AppHelper::Instance()->config("APP_CTRL"); AppHelper::Instance()->config("APP_CTRL", "TestControllers"); AppHelper::Instance()->config("DEFAULT_CMD", 'DefaultController'); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$repositoryPath = __DIR__ . '/repository'; self::$tempPath = __DIR__ . '/temp'; self::$repository = new GitRepository(self::$repositoryPath, self::$tempPath); mkdir(self::$repositoryPath); mkdir(self::$tempPath); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); $helperClass = static::_getHelperClass(); $moduleName = substr($helperClass, 0, strpos($helperClass, '\\')); $application = \Library\Application::init($moduleName, true); static::$_serviceManager = $application->getServiceManager(); static::$_helperManager = static::$_serviceManager->get('ViewHelperManager'); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::$isGdInstalled = function_exists("imagedestroy"); if (self::$isGdInstalled) { self::$testDir = new TestDirHelper(); self::$testDir->create(); } }