本文整理匯總了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());
}