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


PHP stdClass::get_submission_plugin_by_type方法代码示例

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


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

示例1: test_submission_is_empty

 /**
  * Test submission_is_empty
  *
  * @dataProvider submission_is_empty_testcases
  * @param string $submissiontext The online text submission text
  * @param bool $expected The expected return value
  */
 public function test_submission_is_empty($submissiontext, $expected)
 {
     $this->resetAfterTest();
     $plugin = $this->assign->get_submission_plugin_by_type('onlinetext');
     $data = new stdClass();
     $data->onlinetext_editor = ['text' => $submissiontext];
     $result = $plugin->submission_is_empty($data);
     $this->assertTrue($result === $expected);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:locallib_test.php

示例2: test_submission_is_empty

 /**
  * Test submission_is_empty
  *
  * @dataProvider submission_is_empty_testcases
  * @param string $data The file submission data
  * @param bool $expected The expected return value
  */
 public function test_submission_is_empty($data, $expected)
 {
     $this->resetAfterTest();
     $itemid = file_get_unused_draft_itemid();
     $submission = (object) ['files_filemanager' => $itemid];
     $plugin = $this->assign->get_submission_plugin_by_type('file');
     if ($data) {
         $data += ['contextid' => context_user::instance($this->user->id)->id, 'itemid' => $itemid];
         $fs = get_file_storage();
         $fs->create_file_from_string((object) $data, 'Content of ' . $data['filename']);
     }
     $result = $plugin->submission_is_empty($submission);
     $this->assertTrue($result === $expected);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:21,代码来源:locallib_test.php

示例3: test_submission_updated

 /**
  * Test that the submission_updated event is fired when an onlinetext
  * submission is saved and an existing submission already exists.
  */
 public function test_submission_updated()
 {
     $this->resetAfterTest();
     $plugin = $this->assign->get_submission_plugin_by_type('onlinetext');
     $sink = $this->redirectEvents();
     // Create a submission.
     $plugin->save($this->submission, $this->data);
     // Update a submission.
     $plugin->save($this->submission, $this->data);
     $events = $sink->get_events();
     $this->assertCount(4, $events);
     $event = $events[3];
     $this->assertInstanceOf('\\assignsubmission_onlinetext\\event\\submission_updated', $event);
     $this->assertEquals($this->context->id, $event->contextid);
     $this->assertEquals($this->course->id, $event->courseid);
     $this->assertEquals($this->submission->id, $event->other['submissionid']);
     $this->assertEquals($this->submission->attemptnumber, $event->other['submissionattempt']);
     $this->assertEquals($this->submission->status, $event->other['submissionstatus']);
     $this->assertEquals($this->submission->userid, $event->relateduserid);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:events_test.php

示例4: test_submission_updated

 /**
  * Test that the submission_updated event is fired when a file submission is saved when an existing submission already exists.
  */
 public function test_submission_updated()
 {
     $this->resetAfterTest();
     $data = new stdClass();
     $plugin = $this->sepl->get_submission_plugin_by_type('file');
     $sink = $this->redirectEvents();
     // Create a submission.
     $plugin->save($this->submission, $data);
     // Update a submission.
     $plugin->save($this->submission, $data);
     $events = $sink->get_events();
     $this->assertCount(4, $events);
     // We want to test the last event fired.
     $event = $events[3];
     $this->assertInstanceOf('\\seplsubmission_file\\event\\submission_updated', $event);
     $this->assertEquals($this->context->id, $event->contextid);
     $this->assertEquals($this->course->id, $event->courseid);
     $this->assertEquals($this->submission->id, $event->other['submissionid']);
     $this->assertEquals($this->submission->attemptnumber, $event->other['submissionattempt']);
     $this->assertEquals($this->submission->status, $event->other['submissionstatus']);
     $this->assertEquals($this->submission->userid, $event->relateduserid);
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_Baseline,代码行数:25,代码来源:events_test.php


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