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


PHP advanced_testcase类代码示例

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


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

示例1: setUp

 /**
  * Setup.
  */
 public function setUp()
 {
     // Calling parent is good, always.
     parent::setUp();
     // We always need enabled WS for this testcase.
     set_config('enablewebservices', '1');
 }
开发者ID:rushi963,项目名称:moodle,代码行数:10,代码来源:lib_test.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     stack_utils::clear_config_cache();
     self::setup_test_maxima_connection($this);
     $this->resetAfterTest();
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:7,代码来源:test_base.php

示例3: setUp

 /**
  * Setup the tests.
  */
 protected function setUp()
 {
     global $DB;
     parent::setUp();
     $this->resetAfterTest();
     // Create default course.
     $course = $this->getDataGenerator()->create_course(array('category' => 1, 'shortname' => 'ANON'));
     $this->assertNotEmpty($course);
     $page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
     $this->assertNotEmpty($page);
     // Create default group.
     $group = new stdClass();
     $group->courseid = $course->id;
     $group->name = 'ANON';
     $group->id = $DB->insert_record('groups', $group);
     // Create default user.
     $user = $this->getDataGenerator()->create_user(array('username' => 'testuser', 'firstname' => 'Jimmy', 'lastname' => 'Kinnon'));
     // Create default tag.
     $tag = $this->getDataGenerator()->create_tag(array('userid' => $user->id, 'rawname' => 'Testtagname', 'isstandard' => 1));
     // Create default post.
     $post = new stdClass();
     $post->userid = $user->id;
     $post->groupid = $group->id;
     $post->content = 'test post content text';
     $post->module = 'blog';
     $post->id = $DB->insert_record('post', $post);
     // Grab important ids.
     $this->courseid = $course->id;
     $this->cmid = $page->cmid;
     $this->groupid = $group->id;
     $this->userid = $user->id;
     $this->tagid = $tag->id;
     $this->postid = $post->id;
 }
开发者ID:janeklb,项目名称:moodle,代码行数:37,代码来源:events_test.php

示例4: setUp

 protected function setUp()
 {
     global $CFG;
     parent::setup();
     $this->resetAfterTest(true);
     $CFG->grade_droplow = -1;
     $CFG->grade_keephigh = -1;
     $CFG->grade_aggregation = -1;
     $CFG->grade_aggregateonlygraded = -1;
     $CFG->grade_aggregateoutcomes = -1;
     $CFG->grade_aggregatesubcats = -1;
     $this->course = $this->getDataGenerator()->create_course();
     $this->courseid = $this->course->id;
     $this->user[0] = $this->getDataGenerator()->create_user();
     $this->user[1] = $this->getDataGenerator()->create_user();
     $this->user[2] = $this->getDataGenerator()->create_user();
     $this->user[3] = $this->getDataGenerator()->create_user();
     $this->userid = $this->user[0]->id;
     $this->load_modules();
     $this->load_scales();
     $this->load_grade_categories();
     $this->load_grade_items();
     $this->load_grade_grades();
     $this->load_grade_outcomes();
 }
开发者ID:Jinelle,项目名称:moodle,代码行数:25,代码来源:lib.php

示例5: setUp

 /**
  * Setup function
  *   - Allow changes to CFG->debug for testing purposes.
  */
 protected function setUp()
 {
     global $CFG, $DB;
     parent::setUp();
     // Settings to force statistic to run during testing.
     $CFG->timezone = self::TIMEZONE;
     $CFG->statsfirstrun = 'all';
     $CFG->statslastdaily = 0;
     $CFG->statslastexecution = 0;
     // Figure out the broken day start so I can figure out when to the start time should be.
     $time = time();
     $offset = get_timezone_offset($CFG->timezone);
     $stime = $time + $offset;
     $stime = intval($stime / (60 * 60 * 24)) * 60 * 60 * 24;
     $stime -= $offset;
     $shour = intval(($time - $stime) / (60 * 60));
     $CFG->statsruntimestarthour = $shour;
     $CFG->statsruntimestartminute = 0;
     if ($DB->record_exists('user', array('username' => 'user1'))) {
         return;
     }
     // Set up the database.
     $datagen = self::getDataGenerator();
     $user1 = $datagen->create_user(array('username' => 'user1'));
     $user2 = $datagen->create_user(array('username' => 'user2'));
     $course1 = $datagen->create_course(array('shortname' => 'course1'));
     $datagen->enrol_user($user1->id, $course1->id);
     $this->generate_replacement_list();
     // Reset between tests.
     $this->resetAfterTest();
 }
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:35,代码来源:statslib_test.php

示例6: setUp

    /**
     * Pre-test setup. Preserves $CFG.
     */
    public function setUp() {
        global $CFG;
        parent::setUp();

        // Reset $CFG and $SERVER.
        $this->resetAfterTest(true);

        // Consistent initial setup: all players disabled.
        $CFG->core_media_enable_html5video = false;
        $CFG->core_media_enable_html5audio = false;
        $CFG->core_media_enable_mp3 = false;
        $CFG->core_media_enable_flv = false;
        $CFG->core_media_enable_wmp = false;
        $CFG->core_media_enable_qt = false;
        $CFG->core_media_enable_rm = false;
        $CFG->core_media_enable_youtube = false;
        $CFG->core_media_enable_vimeo = false;
        $CFG->core_media_enable_swf = false;

        // Strict headers turned off.
        $CFG->xmlstrictheaders = false;

        $_SERVER = array('HTTP_USER_AGENT' => '');
        $this->pretend_to_be_safari();
    }
开发者ID:nicusX,项目名称:moodle,代码行数:28,代码来源:medialib_test.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->resetAfterTest();
     $user = $this->getDataGenerator()->create_user();
     $this->setUser($user);
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:7,代码来源:coursecatlib_test.php

示例8: setUp

 public function setUp()
 {
     global $CFG;
     parent::setUp();
     $this->resetAfterTest(true);
     $CFG->defaultfrontpageroleid = null;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:7,代码来源:rating_test.php

示例9: setUp

 /**
  * Setup function
  *   - Allow changes to CFG->debug for testing purposes.
  */
 protected function setUp()
 {
     global $CFG, $DB;
     parent::setUp();
     // Settings to force statistic to run during testing.
     $this->setTimezone(self::TIMEZONE);
     core_date::set_default_server_timezone();
     $CFG->statsfirstrun = 'all';
     $CFG->statslastdaily = 0;
     // Figure out the broken day start so I can figure out when to the start time should be.
     $time = time();
     // This nonsense needs to be rewritten.
     $date = new DateTime('now', core_date::get_server_timezone_object());
     $offset = $date->getOffset();
     $stime = $time + $offset;
     $stime = intval($stime / (60 * 60 * 24)) * 60 * 60 * 24;
     $stime -= $offset;
     $shour = intval(($time - $stime) / (60 * 60));
     if ($DB->record_exists('user', array('username' => 'user1'))) {
         return;
     }
     // Set up the database.
     $datagen = self::getDataGenerator();
     $user1 = $datagen->create_user(array('username' => 'user1'));
     $user2 = $datagen->create_user(array('username' => 'user2'));
     $course1 = $datagen->create_course(array('shortname' => 'course1'));
     $datagen->enrol_user($user1->id, $course1->id);
     $this->generate_replacement_list();
     // Reset between tests.
     $this->resetAfterTest();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:35,代码来源:statslib_test.php

示例10: tearDown

 /**
  * Tear down required for all notification tests.
  *
  * This includes emptying the list of notifications on the session, resetting any session which exists, and setting
  * up a new moodle_page object.
  */
 public function tearDown()
 {
     global $PAGE, $SESSION;
     $PAGE = null;
     \core\session\manager::init_empty_session();
     $SESSION->notifications = [];
     parent::tearDown();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:notification_test.php

示例11: setUp

 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 public function setUp()
 {
     $class = $this->get_class_name();
     if (!class_exists($class) || !$class::are_requirements_met()) {
         $this->markTestSkipped('Could not test ' . $class . '. Requirements are not met.');
     }
     parent::setUp();
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:12,代码来源:stores.php

示例12: tearDown

 protected function tearDown()
 {
     $this->teamwork = null;
     $this->course = null;
     $this->cm = null;
     $this->context = null;
     parent::tearDown();
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:8,代码来源:events_test.php

示例13: setUp

 public function setUp()
 {
     parent::setUp();
     $this->resetAfterTest(true);
     if (!($this->tempdir = make_temp_directory('assignfeedback_pdf'))) {
         throw new coding_exception("Unable to create temporary directory");
     }
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:8,代码来源:mypdflib_test.php

示例14: tearDown

 protected function tearDown()
 {
     $this->databasehelper = null;
     $this->course = null;
     $this->users = null;
     $this->resource = null;
     parent::tearDown();
 }
开发者ID:julenpardo,项目名称:moodle-block_mycourse_recommendations,代码行数:8,代码来源:cosine_similarity_associator_test.php

示例15: setUp

 /**
  * Create temporary entries in the database for these tests.
  * These tests have to work no matter the data currently in the database
  * (meaning they should run on a brand new site). This means several items of
  * data have to be artificially inseminated (:-) in the DB.
  */
 protected function setUp()
 {
     parent::setUp();
     // Set global category settings to -1 (not force).
     eventslib_sample_function_handler('reset');
     eventslib_sample_handler_class::static_method('reset');
     $this->resetAfterTest();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:eventslib_test.php


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