diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1e917c..21acc6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: Moodle Plugin CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: test: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e5683f1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +# +# Whenever a new tag starting with "v" is pushed, add the tagged version +# to the Moodle Plugins directory at https://moodle.org/plugins +# +# revision: 2021070201 +# +name: Releasing in the Plugins directory + +on: + push: + tags: + - v* + + workflow_dispatch: + inputs: + tag: + description: 'Tag to be released' + required: true + +defaults: + run: + shell: bash + +jobs: + release-at-moodle-org: + runs-on: ubuntu-latest + env: + PLUGIN: qtype_essaywiris + CURL: curl -s + ENDPOINT: https://moodle.org/webservice/rest/server.php + TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }} + FUNCTION: local_plugins_add_version + + steps: + - name: Call the service function + id: add-version + run: | + if [[ ! -z "${{ github.event.inputs.tag }}" ]]; then + TAGNAME="${{ github.event.inputs.tag }}" + elif [[ $GITHUB_REF = refs/tags/* ]]; then + TAGNAME="${GITHUB_REF##*/}" + fi + if [[ -z "${TAGNAME}" ]]; then + echo "No tag name has been provided!" + exit 1 + fi + ZIPURL="https://api.github.com/repos/${{ github.repository }}/zipball/${TAGNAME}" + RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \ + --data-urlencode "wsfunction=${FUNCTION}" \ + --data-urlencode "moodlewsrestformat=json" \ + --data-urlencode "frankenstyle=${PLUGIN}" \ + --data-urlencode "zipurl=${ZIPURL}" \ + --data-urlencode "vcssystem=git" \ + --data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \ + --data-urlencode "vcstag=${TAGNAME}" \ + --data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \ + --data-urlencode "altdownloadurl=${ZIPURL}") + echo "::set-output name=response::${RESPONSE}" + + - name: Evaluate the response + id: evaluate-response + env: + RESPONSE: ${{ steps.add-version.outputs.response }} + run: | + jq <<< ${RESPONSE} + jq --exit-status ".id" <<< ${RESPONSE} > /dev/null diff --git a/backup/moodle2/backup_qtype_essaywiris_plugin.class.php b/backup/moodle2/backup_qtype_essaywiris_plugin.class.php index 80a5b27..babd659 100644 --- a/backup/moodle2/backup_qtype_essaywiris_plugin.class.php +++ b/backup/moodle2/backup_qtype_essaywiris_plugin.class.php @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -defined('MOODLE_INTERNAL') || die(); - - /** * Provides the information to backup essay questions * diff --git a/backup/moodle2/restore_qtype_essaywiris_plugin.class.php b/backup/moodle2/restore_qtype_essaywiris_plugin.class.php index 91b76af..b4d7218 100644 --- a/backup/moodle2/restore_qtype_essaywiris_plugin.class.php +++ b/backup/moodle2/restore_qtype_essaywiris_plugin.class.php @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -defined('MOODLE_INTERNAL') || die(); - - /** * restore plugin class that provides the necessary information * needed to restore one essay qtype plugin diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 6021a7c..0abad18 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -24,12 +24,8 @@ namespace qtype_essaywiris\privacy; -defined('MOODLE_INTERNAL') || die(); - -class provider implements - // This plugin does not store any personal user data. - \core_privacy\local\metadata\null_provider -{ +// This plugin does not store any personal user data. +class provider implements \core_privacy\local\metadata\null_provider { use \core_privacy\local\legacy_polyfill; /** diff --git a/renderer.php b/renderer.php index 9f81b50..9df8e63 100644 --- a/renderer.php +++ b/renderer.php @@ -19,7 +19,7 @@ require_once($CFG->dirroot . '/question/type/essay/renderer.php'); -class qtype_essaywiris_renderer extends qtype_wq_renderer { +class qtype_essaywiris_renderer extends qtype_wq_renderer { public function __construct(moodle_page $page, $target) { parent::__construct(new qtype_essay_renderer($page, $target), $page, $target); } diff --git a/tests/behat/auxiliar_text.feature b/tests/behat/auxiliar_text.feature index 1709ecf..4ce097f 100644 --- a/tests/behat/auxiliar_text.feature +++ b/tests/behat/auxiliar_text.feature @@ -40,7 +40,8 @@ Feature: A teacher can add and preview an auxiliar text field in a Science Essay And I open Wiris Quizzes Studio And I click on "Input options" "text" And I click on "Display auxiliary text field" "text" - And I click on "//*[@id='wrsUI_quizzesStudioHomeSaveButton']" "xpath_element" + And I go back in Wiris Quizzes Studio + And I save Wiris Quizzes Studio And I click on "//input[@name='submitbutton']" "xpath_element" And I click on "Preview question" "link" And I switch to "questionpreview" window diff --git a/tests/helper.php b/tests/helper.php index 1c72dad..d4644a1 100644 --- a/tests/helper.php +++ b/tests/helper.php @@ -22,16 +22,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - - -/** - * Test helper class for the Wiris Essay question type. - * - * @copyright 2013 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ class qtype_essaywiris_test_helper extends question_test_helper { public function get_test_questions() { return array('scienceessay'); diff --git a/version.php b/version.php index 0ef4d85..0c91465 100644 --- a/version.php +++ b/version.php @@ -16,11 +16,11 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2022040800; -$plugin->release = '4.4.3'; -$plugin->requires = 2011060313; +$plugin->version = 2022061500; +$plugin->requires = 2015111600; // Moodle 3.0. +$plugin->release = '4.5.0'; $plugin->maturity = MATURITY_STABLE; $plugin->component = 'qtype_essaywiris'; $plugin->dependencies = array ( - 'qtype_wq' => 2022040800 + 'qtype_wq' => 2022061500 );