Skip to content

Commit

Permalink
Release specifying that 4.0 is not supported; add GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed May 22, 2022
1 parent 77ec7d9 commit c92644c
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/yui/build/** -diff
**/amd/build/** -diff
110 changes: 110 additions & 0 deletions .github/workflows/moodle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Moodle Plugin CI

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-18.04

services:
postgres:
image: postgres:10
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
mariadb:
image: mariadb:10
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"

ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3

strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4']
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
database: [pgsql, mariadb]

steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
path: plugin

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Install moodle-plugin-ci
run: |
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: PHP Lint
if: ${{ always() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc

- name: Validating
if: ${{ always() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
run: moodle-plugin-ci phpunit --fail-on-warning

- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
moodle-format_flexsections
==========================

Version 3.5.2
-------------

- Specified compatibility with 3.5 - 3.11
- Added GHA and fixed coding styles issues and behat failures

Version 3.5.1
-------------

Expand Down
12 changes: 10 additions & 2 deletions amd/build/format.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/format.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace format_flexsections\privacy;
defined('MOODLE_INTERNAL') || die();

/**
* Privacy Subsystem for format_flexsections implementing null_provider.
Expand All @@ -40,4 +39,4 @@ class provider implements \core_privacy\local\metadata\null_provider {
public static function get_reason() : string {
return 'privacy:metadata';
}
}
}
18 changes: 9 additions & 9 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function find_collapsed_parent($section, $returnid = false) {
*
* The returned object's property (boolean)capable indicates that
* the course format supports Moodle course ajax features.
* The property (array)testedbrowsers can be used as a parameter for {@link ajaxenabled()}.
* The property (array)testedbrowsers can be used as a parameter for {@see ajaxenabled()}.
*
* @return stdClass
*/
Expand All @@ -155,10 +155,10 @@ public function supports_ajax() {
/**
* Loads all of the course sections into the navigation
*
* This method is called from {@link global_navigation::load_course_sections()}
* This method is called from {@see global_navigation::load_course_sections()}
*
* When overwriting please note that navigationlib relies on using the correct values for
* arguments $type and $key in {@link navigation_node::add()}
* arguments $type and $key in {@see navigation_node::add()}
*
* Example of code creating a section node:
* $sectionnode = $node->add($sectionname, $url, navigation_node::TYPE_SECTION, null, $section->id);
Expand Down Expand Up @@ -342,12 +342,12 @@ public function course_format_options($foreditform = false) {
/**
* Definitions of the additional options that this course format uses for section
*
* See {@link format_base::course_format_options()} for return array definition.
* See {@see format_base::course_format_options()} for return array definition.
*
* Additionally section format options may have property 'cache' set to true
* if this option needs to be cached in {@link get_fast_modinfo()}. The 'cache' property
* is recommended to be set only for fields used in {@link format_base::get_section_name()},
* {@link format_base::extend_course_navigation()} and {@link format_base::get_view_url()}
* if this option needs to be cached in {@see get_fast_modinfo()}. The 'cache' property
* is recommended to be set only for fields used in {@see format_base::get_section_name()},
* {@see format_base::extend_course_navigation()} and {@see format_base::get_view_url()}
*
* For better performance cached options are recommended to have 'cachedefault' property
* Unlike 'default', 'cachedefault' should be static and not access get_config().
Expand Down Expand Up @@ -657,7 +657,7 @@ public function page_set_course(moodle_page $page) {
/**
* Adds format options elements to the course/section edit form
*
* This function is called from {@link course_edit_form::definition_after_data()}
* This function is called from {@see course_edit_form::definition_after_data()}
*
* @param MoodleQuickForm $mform form the elements are added to
* @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form
Expand Down Expand Up @@ -1154,7 +1154,7 @@ protected function move_section($section, $parent, $before = null) {
/**
* Course-specific information to be output immediately above content on any course page
*
* See {@link format_base::course_header()} for usage
* See {@see format_base::course_header()} for usage
*
* @return null|renderable null for no output or object with data for plugin renderer
*/
Expand Down
2 changes: 1 addition & 1 deletion renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected function render_format_flexsections_edit_control(format_flexsections_e
$text = $this->render($icon). html_writer::tag('span', $control->text,
['class' => $control->actionname.'-text']);
$action = new action_link($control->url, $text, null, ['data-action' => $control->actionname]);
return html_writer::tag('div', $this->render($action), ['class' => 'mdl-right']);
return html_writer::tag('div', $this->render($action), ['class' => 'mdl-right flexsections-add-subsection']);
} else if ($control->actionname === 'backto') {
$icon = new pix_icon('t/up', '', 'moodle');
$text = $this->render($icon). html_writer::tag('span', $control->text,
Expand Down
19 changes: 2 additions & 17 deletions tests/behat/basic_actions.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@format @format_flexsections
@format @format_flexsections @javascript
Feature: Using course in flexsections format
In order to use flexsections format
As a teacher and student
Expand Down Expand Up @@ -32,8 +32,7 @@ Feature: Using course in flexsections format
| Forum name | Second module |
| Description | Test |

@javascript
Scenario: Add sections and activities to flexsections format with JS on
Scenario: Add sections and activities to flexsections format
Given I should see "First module"
And I should see "Second module"
And I log out
Expand All @@ -42,17 +41,6 @@ Feature: Using course in flexsections format
Then I should see "First module"
And I should see "Second module"

Scenario: Add sections and activities to flexsections format with JS off
Given I should see "First module"
And I should see "Second module"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
And I should see "Topic 2"
And I should see "First module"
And I should see "Second module"

Scenario: Hiding section in flexsections format
When I click on "Hide" "link" in the "li#section-2" "css_element"
And I log out
Expand All @@ -73,7 +61,6 @@ Feature: Using course in flexsections format
And I should not see "Topic 2"
And I should not see "Second module"

@javascript
Scenario: Collapsing section in flexsections format
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
Expand All @@ -94,7 +81,6 @@ Feature: Using course in flexsections format
And I should see "Topic 2" in the "Navigation" "block"
And I should see "Second module" in the "Navigation" "block"

@javascript
Scenario: Collapsing section with subsections in flexsections format
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
Expand Down Expand Up @@ -122,7 +108,6 @@ Feature: Using course in flexsections format
And I expand "Topic 2" node
And I should see "Second module" in the "Navigation" "block"

@javascript
Scenario: Merging subsection in flexsections format
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
Expand Down
Loading

0 comments on commit c92644c

Please sign in to comment.