diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aea56f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/* +tests/behat \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 5aae5a3..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "tests/behat"] - path = tests/behat - url = https://github.com/turnitin/moodle-plagiarism-turnitinsim-behat.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e42727..101185b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +### Date: 2020-April-17 +### Release: v2020041701 + +#### :wrench: Fixes and enhancements + +--- + +#### Plugin successfully installs via zip file. + +We have fixed an issue where the plugin may not install if downloaded from the Moodle plugin directory due to it containing an empty behat directory. + +--- + ### Date: 2020-April-15 ### Release: v2020041501 diff --git a/README.md b/README.md index 89f79ae..02cbbdb 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,17 @@ To configure the plugin go to `"Site administration" > "Plugins" > "Plagiarism" Testing - -This plugin contains a full suite of PHPUnit and behat tests which can be run against your moodle installation. +This plugin contains a full suite of PHPUnit tests which can be run against your Moodle installation. Provided your environment is already configured to run PHPUnit tests, then run the following command from the Moodle root directory: `vendor/bin/phpunit --testsuite plagiarism_turnitinsim_testsuite` -Provided your environment is already configured to run Behat tests, then run the following command from the Moodle root directory: +Provided your environment is already configured to run Behat tests, you can download and install our behat tests from their repository by running the following command from the plugin root directory: + +`git clone https://github.com/turnitin/moodle-plagiarism-turnitinsim-behat.git tests/behat` + +Then run the following command from the Moodle root directory: `php admin/tool/behat/cli/run.php --tags=@plagiarism_turnitinsim` diff --git a/classes/submission.class.php b/classes/submission.class.php index eb4a01e..a539c48 100644 --- a/classes/submission.class.php +++ b/classes/submission.class.php @@ -744,7 +744,8 @@ public function handle_similarity_response($params) { break; default: - // File contents have been uploaded and the submission is being processed. TURNITINSIM_SUBMISSION_STATUS_PROCESSING. + // File contents have been uploaded and the submission is being processed. + // Status of TURNITINSIM_SUBMISSION_STATUS_PROCESSING. // Or get_submission_info() returns no response. Allow another try in an hour. $this->settiiattempts($this->gettiiattempts() + 1); $this->settiiretrytime(time() + ($this->gettiiattempts() * TURNITINSIM_REPORT_GEN_RETRY_WAIT_SECONDS)); diff --git a/classes/task.class.php b/classes/task.class.php index 7ae7424..7e13b21 100644 --- a/classes/task.class.php +++ b/classes/task.class.php @@ -91,7 +91,12 @@ public function send_queued_submissions() { // Get Submissions to send. $submissions = $DB->get_records_select('plagiarism_turnitinsim_sub', '(status = ? OR status = ?) AND tiiattempts < ? AND tiiretrytime < ?', - array(TURNITINSIM_SUBMISSION_STATUS_QUEUED, TURNITINSIM_SUBMISSION_STATUS_CREATED, TURNITINSIM_SUBMISSION_MAX_SEND_ATTEMPTS, time()), + array( + TURNITINSIM_SUBMISSION_STATUS_QUEUED, + TURNITINSIM_SUBMISSION_STATUS_CREATED, + TURNITINSIM_SUBMISSION_MAX_SEND_ATTEMPTS, + time() + ), '', '*', 0, TURNITINSIM_SUBMISSION_SEND_LIMIT); diff --git a/tests/behat b/tests/behat deleted file mode 160000 index 264dcec..0000000 --- a/tests/behat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 264dcecb18185b88de449dce8f4c6a03be7b56c8 diff --git a/tests/classes/tssubmission_test.php b/tests/classes/tssubmission_test.php index 9bf07cf..12970c7 100644 --- a/tests/classes/tssubmission_test.php +++ b/tests/classes/tssubmission_test.php @@ -1692,6 +1692,9 @@ public function test_similarity_overrides_are_false() { $this->assertFalse($overrides['view_settings']['save_changes']); } + /** + * Test that the similarity response status sets correct values if status is COMPLETE. + */ public function test_handle_similarity_response_status_sets_correct_values_if_status_is_complete() { global $DB; @@ -1720,6 +1723,9 @@ public function test_handle_similarity_response_status_sets_correct_values_if_st $this->assertEquals(50, $record->overallscore); } + /** + * Test that the similarity response status sets correct values if status is CREATED. + */ public function test_handle_similarity_response_status_sets_correct_values_if_status_is_created() { global $DB; @@ -1761,6 +1767,9 @@ public function test_handle_similarity_response_status_sets_correct_values_if_st $this->assertEquals(self::TEST_ERROR_MESSAGE_2, $record->errormessage); } + /** + * Test that the similarity response status sets correct values if status is ERROR. + */ public function test_handle_similarity_response_status_sets_correct_values_if_status_is_error() { global $DB; @@ -1802,6 +1811,9 @@ public function test_handle_similarity_response_status_sets_correct_values_if_st $this->assertEquals(self::TEST_ERROR_MESSAGE_1, $record->errormessage); } + /** + * Test that the similarity response status sets correct values if status is PROCESSING. + */ public function test_handle_similarity_response_status_sets_correct_values_if_status_is_processing() { global $DB; @@ -1841,6 +1853,9 @@ public function test_handle_similarity_response_status_sets_correct_values_if_st $this->assertGreaterThan(time(), $record->tiiretrytime); } + /** + * Test that the similarity response status sets correct values if the request fails. + */ public function test_handle_similarity_response_status_sets_correct_values_if_request_fails() { global $DB; diff --git a/version.php b/version.php index 89e267c..1f127d8 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2020041501; +$plugin->version = 2020041701; $plugin->release = "v1.1"; $plugin->requires = 2017051500; $plugin->component = 'plagiarism_turnitinsim';