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


PHP info_module::get_full_information方法代码示例

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


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

示例1: test_info_module

 /**
  * Tests the info_module class (is_available, get_full_information).
  */
 public function test_info_module()
 {
     global $DB;
     // Create a course and pages.
     $this->setAdminUser();
     $this->resetAfterTest();
     $generator = $this->getDataGenerator();
     $course = $generator->create_course();
     $rec = array('course' => $course);
     $page1 = $generator->get_plugin_generator('mod_page')->create_instance($rec);
     $page2 = $generator->get_plugin_generator('mod_page')->create_instance($rec);
     $page3 = $generator->get_plugin_generator('mod_page')->create_instance($rec);
     $page4 = $generator->get_plugin_generator('mod_page')->create_instance($rec);
     // Set up the availability option for the pages to mock options.
     $DB->set_field('course_modules', 'availability', '{"op":"|","show":true,"c":[' . '{"type":"mock","a":false,"m":"grandmaster flash"}]}', array('id' => $page1->cmid));
     $DB->set_field('course_modules', 'availability', '{"op":"|","show":true,"c":[' . '{"type":"mock","a":true,"m":"the furious five"}]}', array('id' => $page2->cmid));
     // Third page is invalid. (Fourth has no availability settings.)
     $DB->set_field('course_modules', 'availability', '{{{', array('id' => $page3->cmid));
     $modinfo = get_fast_modinfo($course);
     $cm1 = $modinfo->get_cm($page1->cmid);
     $cm2 = $modinfo->get_cm($page2->cmid);
     $cm3 = $modinfo->get_cm($page3->cmid);
     $cm4 = $modinfo->get_cm($page4->cmid);
     // Do availability and full information checks.
     $info = new info_module($cm1);
     $information = '';
     $this->assertFalse($info->is_available($information));
     $this->assertEquals('SA: grandmaster flash', $information);
     $this->assertEquals('SA: [FULL]grandmaster flash', $info->get_full_information());
     $info = new info_module($cm2);
     $this->assertTrue($info->is_available($information));
     $this->assertEquals('', $information);
     $this->assertEquals('SA: [FULL]the furious five', $info->get_full_information());
     // Check invalid one.
     $info = new info_module($cm3);
     $this->assertFalse($info->is_available($information));
     $debugging = phpunit_util::get_debugging_messages();
     phpunit_util::reset_debugging();
     $this->assertEquals(1, count($debugging));
     $this->assertContains('Invalid availability', $debugging[0]->message);
     // Check empty one.
     $info = new info_module($cm4);
     $this->assertTrue($info->is_available($information));
     $this->assertEquals('', $information);
     $this->assertEquals('', $info->get_full_information());
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:49,代码来源:info_test.php


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