本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}