當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。