当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestCase::setUpBeforeClass方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestCase::setUpBeforeClass方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::setUpBeforeClass方法的具体用法?PHP PHPUnit_Framework_TestCase::setUpBeforeClass怎么用?PHP PHPUnit_Framework_TestCase::setUpBeforeClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestCase的用法示例。


在下文中一共展示了PHPUnit_Framework_TestCase::setUpBeforeClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpBeforeClass

    /**
     * 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());
            }
        }
    }
开发者ID:bosoy83,项目名称:progtest,代码行数:33,代码来源:sprig.php

示例2: setUpBeforeClass

 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');
 }
开发者ID:nemphys,项目名称:magento2,代码行数:7,代码来源:CategoryImageTest.php

示例3: setUpBeforeClass

 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();
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:7,代码来源:SearchEngineTest.php

示例4: 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);
 }
开发者ID:versionpress,项目名称:versionpress,代码行数:34,代码来源:SynchronizerTestCase.php

示例5: setUpBeforeClass

    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);
    }
开发者ID:ryan125125,项目名称:elasticsearch-test,代码行数:31,代码来源:TestIndex.php

示例6: setUpBeforeClass

 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();
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:7,代码来源:CiviEndToEndTestCase.php

示例7: 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();
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:14,代码来源:JKeychainTest.php

示例8: 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();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:34,代码来源:BaseTest.php

示例9: setUpBeforeClass

 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;
 }
开发者ID:educakanchay,项目名称:campus,代码行数:28,代码来源:database_driver_testcase.php

示例10: setUpBeforeClass

 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");
 }
开发者ID:BPing,项目名称:PHPCbping,代码行数:7,代码来源:FunctionTest.php

示例11: setUpBeforeClass

 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();
 }
开发者ID:nilportugues,项目名称:json-api,代码行数:27,代码来源:AbstractTestCase.php

示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     if (!is_object(self::$client)) {
         self::$client = new Client();
     }
 }
开发者ID:dayax,项目名称:wordpress-test,代码行数:7,代码来源:ThemeTestCase.php

示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $CI =& get_instance();
     $CI->load->library('Twig');
     $CI->load->helper('url_helper');
 }
开发者ID:Tomo20151120,项目名称:codeigniter-ss-twig,代码行数:7,代码来源:TwigHelperTest.php

示例14: setUpBeforeClass

 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);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:HourlyTest.php

示例15: setUpBeforeClass

 /**
  * @inheritdoc
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     foreach (self::$uuids as $i => $uuid) {
         self::$uuids[$i] = Uuid::fromString($uuid);
     }
 }
开发者ID:a-mayer,项目名称:boekkooi-broadway,代码行数:10,代码来源:MockUuidSequenceGeneratorTest.php


注:本文中的PHPUnit_Framework_TestCase::setUpBeforeClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。