Exemple #1
0
 /**
  * Test new_submission_empty
  *
  * @dataProvider submission_is_empty_testcases
  * @param string $submissiontext The file submission data
  * @param bool $expected The expected return value
  */
 public function test_new_submission_empty($submissiontext, $expected)
 {
     $this->resetAfterTest();
     $data = new stdClass();
     $data->onlinetext_editor = ['text' => $submissiontext];
     $result = $this->assign->new_submission_empty($data);
     $this->assertTrue($result === $expected);
 }
Exemple #2
0
 /**
  * Test new_submission_empty
  *
  * @dataProvider submission_is_empty_testcases
  * @param string $data The file submission data
  * @param bool $expected The expected return value
  */
 public function test_new_submission_empty($data, $expected)
 {
     $this->resetAfterTest();
     $itemid = file_get_unused_draft_itemid();
     $submission = (object) ['files_filemanager' => $itemid];
     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 = $this->assign->new_submission_empty($submission);
     $this->assertTrue($result === $expected);
 }