Skip to content

Update for Moodle 5.0 #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
> **Note:** Please fill out all required sections and remove irrelevant ones.

### 📋 Kind of PR

- [ ] Fixes a bug
- [ ] Updates for a new Moodle version
- [ ] Adds a new feature of functionality
- [ ] Improves or enhances existing features
- [ ] Refactoring: restructures code for better performance or maintainability
- [ ] Testing: add missing or improve existing tests
- [ ] Miscellaneous: code cleaning (without functional changes), documentation, configuration, ...
---

### 🧩 Description

Please describe the purpose of this PR in a few sentences.

- What feature or bug does it address?
- Why is this change or addition necessary?
- What is the expected behavior after the change?

---

### ✅ Checklist

Please confirm the following (check all that apply):

- [ ] I have `phpunit` and/or `behat` tests that cover my changes or additions.
- [ ] Code passes the code checker without errors and warnings.
- [ ] Code passes the moodle-ci/cd pipeline on all supported Moodle versions or the ones the plugin supports.
- [ ] Code does not have `var_dump()` or `var_export` or any other debugging statements that should not appear on the productive branch.
- [ ] Code only uses language strings instead of hard-coded strings.
- [ ] If there are changes in the database: I updated/created the necessary upgrade steps in `db/upgrade.php` and updated the `version.php`.
- [ ] If there are changes in javascript: I build new `.min` files with the `grunt amd` command.
- [ ] If it is a Moodle update PR: I read the release notes, updated the `version.php` and added the new moodle version to the workflow file. I ran all tests thoroughly checking for errors.

---

### 🧱 Related Issue

- Related to #[IssueNumber]

---

### 🗒️ Additional Notes

Any other relevant information.
28 changes: 19 additions & 9 deletions .github/workflows/config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{
"main-moodle": "MOODLE_405_STABLE",
"moodle-plugin-ci": "4.5.7",
"main-moodle": "MOODLE_500_STABLE",
"main-php": "8.3",
"moodle-php": {
"MOODLE_401_STABLE": ["7.4", "8.1"],
"MOODLE_402_STABLE": ["8.0", "8.2"],
"MOODLE_403_STABLE": ["8.0", "8.2"],
"MOODLE_404_STABLE": ["8.1", "8.3"],
"MOODLE_405_STABLE": ["8.1", "8.2", "8.3"]
},
"moodle-plugin-ci": "4.4.5"
"main-db": "pgsql",
"moodle-testmatrix": {
"MOODLE_401_STABLE": {
"php": ["8.0", "8.1"]
},
"MOODLE_404_STABLE": {
"php": ["8.1", "8.2", "8.3"]
},
"MOODLE_405_STABLE": {
"php": ["8.1", "8.2", "8.3"],
"db": ["pgsql", "mariadb", "mysqli"]
},
"MOODLE_500_STABLE": {
"php": ["8.2", "8.3", "8.4"],
"db": ["pgsql", "mariadb", "mysqli"]
}
}
}
2 changes: 2 additions & 0 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ jobs:
call:
name: ""
uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-ci.yml@main
with:
allow-mustache-lint-error: true
7 changes: 3 additions & 4 deletions tests/behat/download_qrcode.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ Feature: Download QR code as .png file
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | Crs1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "QR code" block
And I log out
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| qrcode | Course | Crs1 | course-view-* | site-post |

@javascript
Scenario: Teacher sees the QR code and clicks on the Download button
Expand Down
7 changes: 3 additions & 4 deletions tests/behat/show_qrcode.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ Feature: Display the QR code block
| user | course | role |
| teacher1 | Crs1 | editingteacher |
| student1 | Crs1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "QR code" block
And I log out
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| qrcode | Course | Crs1 | course-view-* | site-post |

@javascript
Scenario: Only enrolled students are able to see the QR code and they don't see the download button
Expand Down
1 change: 1 addition & 0 deletions tests/output_image_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ final class output_image_test extends \advanced_testcase {
* Create a course and a block instance.
*/
protected function setUp(): void {
parent::setUp();
$generator = $this->getDataGenerator()->get_plugin_generator('block_qrcode');
$this->course = $generator->create_course()['course'];
$this->block = $generator->create_instance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ public function encode(SplFixedArray $data, SplFixedArray $parity) : void

/**
* Decodes received data.
* // TODO: Send this to moodle hq.
*/
public function decode(SplFixedArray $data, SplFixedArray $erasures = null) : ?int
public function decode(SplFixedArray $data, ?SplFixedArray $erasures = null) : ?int
{
// This speeds up the initialization a bit.
$numRootsPlusOne = SplFixedArray::fromArray(array_fill(0, $this->numRoots + 1, 0), false);
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
$plugin->component = 'block_qrcode'; // Full name of the plugin.
$plugin->maturity = MATURITY_STABLE;
$plugin->release = 'v4.5-r1';
$plugin->version = 2025022400; // The current plugin version (Date: YYYMMDDXX).
$plugin->version = 2025062400; // The current plugin version (Date: YYYMMDDXX).
$plugin->requires = 2022112800; // Requires Moodle 4.1+.
Loading