Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebleu committed Apr 5, 2024
1 parent 0a51f67 commit b73d547
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 14 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
fail-fast: false
matrix:
moodle-branch: ['MOODLE_402_STABLE', 'MOODLE_403_STABLE']
php: ['8.1']
php: ['8.2']
database: ['mariadb', 'pgsql']
include:
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
- php: '8.3'
moodle-branch: 'main'
database: 'pgsql'

steps:
Expand Down Expand Up @@ -117,9 +117,19 @@ jobs:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: chrome
id: behat
if: ${{ !cancelled() }}
run: moodle-plugin-ci --ansi behat --profile chrome

- name: Upload Behat Faildump
if: ${{ failure() && steps.behat.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: Behat Faildump (${{ join(matrix.*, ', ') }})
path: ${{ github.workspace }}/moodledata/behat_dump
retention-days: 7
if-no-files-found: ignore

- name: chrome classic
if: ${{ !cancelled() }}
run: moodle-plugin-ci --ansi behat --suite classic --profile chrome
Expand Down
31 changes: 29 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
## v4.0.0 (2022-04-19)
## [4.2.2](https://github.com/ewallah/moodle-availability_language/compare/v4.2.1...v4.2.2) (2024-03-13)

* code review
* PHP 8.3
* different behat tests for main
* changelogs

## [4.2.1](https://github.com/ewallah/moodle-availability_language/compare/v4.0.2...v4.2.1) (2024-03-11)

* master => main
* code review (final test classes)
* iplusacademy icon

## [4.0.2](https://github.com/ewallah/moodle-availability_language/compare/v4.0.1...v4.0.2) (2023-10-14)

* MOODLE_403_STABLE
* script always => not canceled
* code review (use /... => use ...)

## [4.0.1](https://github.com/ewallah/moodle-availability_language/compare/v4.0.0...v4.0.1) (2023-04-23)

* MOODLE_402_STABLE
* better tests
* better documentation

## [4.0.0](https://github.com/ewallah/moodle-availability_language/compare/v3.11.1...v4.0.0) (2022-04-19)

* MOODLE_400_STABLE
* no master language yet
* version upgrade

## v3.11.1 (2022-03-10)
## [3.11.1](https://github.com/ewallah/moodle-availability_language/compare/v3.9.9...v3.11.1) (2022-03-10)

* MOODLE_311_STABLE

## v3.9.9 (2022-03-10)

Expand Down
3 changes: 1 addition & 2 deletions classes/condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class condition extends \core_availability\condition {

/** @var string ID of language that this condition requires, or '' = any language */
protected $languageid;

Expand Down Expand Up @@ -140,7 +139,7 @@ public function is_available($not, \core_availability\info $info, $grabthelot, $
*/
public function get_description($full, $not, \core_availability\info $info) {
if ($this->languageid != '') {
$installedlangs = get_string_manager()->get_list_of_translations(false);
$installedlangs = get_string_manager()->get_list_of_translations();
if (array_key_exists($this->languageid, $installedlangs)) {
$snot = $not ? 'not' : '';
return get_string('getdescription' . $snot, 'availability_language', $installedlangs[$this->languageid]);
Expand Down
5 changes: 2 additions & 3 deletions classes/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class frontend extends \core_availability\frontend {

/**
* Additional parameters for the plugin's initInner function.
*
Expand All @@ -46,7 +45,7 @@ class frontend extends \core_availability\frontend {
* @return array Array of parameters for the JavaScript function
*/
protected function get_javascript_init_params($course, \cm_info $cm = null, \section_info $section = null) {
return [self::convert_associative_array_for_js(get_string_manager()->get_list_of_translations(false), 'id', 'name')];
return [self::convert_associative_array_for_js(get_string_manager()->get_list_of_translations(), 'id', 'name')];
}

/**
Expand All @@ -66,6 +65,6 @@ protected function allow_add($course, \cm_info $cm = null, \section_info $sectio
return false;
}
// If there is only one language installed.
return count(get_string_manager()->get_list_of_translations(false)) > 1;
return count(get_string_manager()->get_list_of_translations()) > 1;
}
}
1 change: 0 additions & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {

/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
Expand Down
3 changes: 1 addition & 2 deletions tests/condition_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
* @coversDefaultClass \availability_language
*/
final class condition_test extends \advanced_testcase {

/**
* Load required classes.
*/
Expand Down Expand Up @@ -205,7 +204,7 @@ public function test_get_description(): void {
*/
public function test_frontend(): void {
global $CFG;
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
require_once($CFG->dirroot . '/mod/lesson/locallib.php');
$this->resetAfterTest();
$this->setAdminUser();
set_config('enableavailability', true);
Expand Down
1 change: 0 additions & 1 deletion tests/privacy/privacy_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class privacy_test extends provider_testcase {

/**
* Test returning metadata.
* @covers \availability_language\privacy\provider
Expand Down

0 comments on commit b73d547

Please sign in to comment.