Compare commits

..

134 Commits

Author SHA1 Message Date
Jun Pataleta cd71612cf6 Moodle release 3.11.13 2023-03-11 13:10:27 +08:00
Jun Pataleta a4874cb9c5 weekly release 3.11.12+ 2023-03-10 22:10:03 +08:00
Jun Pataleta 90818a22ad Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2023-03-10 22:10:01 +08:00
Ilya Tregubov 28bb2b50d6 Merge branch 'MDL-77429-311-fix' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-03-10 14:50:40 +08:00
Andrew Nicols 28d6953d48 MDL-77429 course: Change course date to previous day
When a test runs just after midnight, and the user time zone is not the
same as the server timezone, and the course is created using a generator
(which runs in server time zone) but the UI presented in the user
timezone, the course start time is still in the future.

We need to create the course a day earlier to ensure that the "This
week" indicator is in the correct day.
2023-03-10 14:11:23 +08:00
Jun Pataleta c7b3edf823 Merge branch 'MDL-77458-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-03-10 12:05:56 +08:00
Andrew Nicols 880e150587 Merge branch 'MDL-77429-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-03-09 22:12:39 +08:00
Andrew Nicols 760a316679 Merge branch 'MDL-77463-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-03-09 22:04:24 +08:00
Jun Pataleta 525f816567 Merge branch 'MDL-77559-311-2' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-03-09 15:46:24 +08:00
Angelia Dela Cruz 40b1954431 MDL-77463 Behat: Coverage for assign submission notification to teacher 2023-03-09 12:56:39 +08:00
Angelia Dela Cruz 9f152581f0 MDL-77429 Behat: Add coverage for changing course format as teacher 2023-03-09 10:01:40 +08:00
Andrew Nicols 1a624afb87 MDL-77559 js: Rebuild all JS with Node 16 2023-03-09 08:22:29 +08:00
Andrew Nicols f80a3bce0a MDL-77559 js: Revert "MDL-75012 core: Bump NodeJS version requirements"
This reverts commit fb8fa74655.
2023-03-09 08:21:22 +08:00
Andrew Nicols 4deb1eea56 MDL-77559 js: Revert "MDL-75012 js: Bump standard dependencies"
This reverts commit 811526b0a6.
2023-03-09 08:21:19 +08:00
Andrew Nicols 77c72b0bd7 MDL-77559 js: Revert "MDL-75012 js: Remove grunt-contrib-uglify"
This reverts commit d01eba812b.
2023-03-09 08:21:15 +08:00
Andrew Nicols a15df02640 MDL-77559 js: Revert "MDL-75012 js: Bump stylelint and components"
This reverts commit 9899fc0a0f.
2023-03-09 08:21:12 +08:00
Andrew Nicols e5dd087852 MDL-77559 js: Revert "MDL-75012 js: Update browserslist"
This reverts commit c920bb6db5.
2023-03-09 08:21:07 +08:00
Andrew Nicols f46643fd61 MDL-77559 js: Revert "MDL-75012 js: Bump node-sass"
This reverts commit 173b61bf69.
2023-03-09 08:21:03 +08:00
Andrew Nicols 426e58d35d MDL-77559 js: Revert "MDL-75012 js: Audit fix"
This reverts commit dfea25b3d7.
2023-03-09 08:20:57 +08:00
Andrew Nicols be86e18ff1 MDL-77559 js: Revert "MDL-75012 js: Use our own jsdoc wrapper"
This reverts commit a22e2aa0d7.
2023-03-09 08:20:53 +08:00
Andrew Nicols d33aa94074 MDL-77559 js: Revert "MDL-75012 js: Bump shifter to new version"
This reverts commit 0ebccd5bb4.
2023-03-09 08:20:49 +08:00
Andrew Nicols 47fcb7c012 MDL-77559 js: Revert "MDL-75012 js: Put shifter on a diet"
This reverts commit 8d6e0dc416.
2023-03-09 08:20:45 +08:00
Andrew Nicols 7fd65d8896 MDL-77559 js: Revert "MDL-75012 js: Remove unused babel-preset-minify dependency"
This reverts commit 35ef8a9e40.
2023-03-09 08:20:42 +08:00
Andrew Nicols 4ad6481a77 MDL-77559 js: Revert "MDL-75012 js: Bump Babel dependencies"
This reverts commit 0a95429dce.
2023-03-09 08:19:26 +08:00
AMOS bot 40d01acce6 Automatically generated installer lang files 2023-03-09 00:07:34 +00:00
Ilya Tregubov f5daf410af Merge branch 'MDL-77414-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-03-08 17:06:17 +08:00
Angelia Dela Cruz 40510605e4 MDL-77414 Behat: Coverage for "Require all group members submit" setting 2023-03-08 14:52:46 +08:00
Petr Skoda b436508b24 MDL-77524 filter_algebra: fix error message 2023-03-08 11:27:28 +08:00
Paul Holden 98bbce7011 MDL-75517 report_participation: filter report by viewable roles only. 2023-03-08 10:38:29 +08:00
Michael Hawkins 04d74da325 MDL-77204 mod_wiki: Clean filename in Moodle1 backup 2023-03-08 10:34:18 +08:00
Paul Holden 90c5358680 MDL-77046 availability: validate profile field in condition. 2023-03-08 10:24:37 +08:00
Paul Holden 882b9d67f5 MDL-76809 gradereport_history: pre-filter report userids filter.
Ensure current user is able to access each of the provided userids.
2023-03-08 10:01:32 +08:00
Ilya Tregubov 591ffa267d Merge branch 'MDL-77446-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-03-08 09:20:01 +08:00
AMOS bot 7c10813e02 Automatically generated installer lang files 2023-03-08 00:07:36 +00:00
Petr Skoda a099b1d893 MDL-76645 filter_data: fix link title attribute 2023-03-07 14:49:50 +00:00
Lars Bonczek 39ab1182d9 MDL-75659 core: Don't render component argument twice in mustache pix helper 2023-03-07 14:49:50 +00:00
Angelia Dela Cruz 9e5bf8d4d5 MDL-77446 Behat: Add coverage for changing uploaded file details 2023-03-07 16:14:34 +08:00
AMOS bot fc2ed595d9 Automatically generated installer lang files 2023-03-07 00:07:34 +00:00
Jun Pataleta 86f1bf85c4 Merge branch 'MDL-77428-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-03-03 16:34:50 +08:00
Jake Dallimore 4e858410ea weekly release 3.11.12+ 2023-03-03 11:08:47 +08:00
Jake Dallimore dd581ff3f5 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2023-03-03 11:08:45 +08:00
Andrew Nicols 1a70b72b41 MDL-77458 core: Add supported php version info to phpcs config 2023-03-02 20:37:52 +08:00
Angelia Dela Cruz c7b2f34748 MDL-77428 Behat: Add coverage for forum post word count 2023-03-02 13:48:47 +08:00
Jun Pataleta ee828d828a Merge branch 'MDL-75012-311-5' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-03-02 12:25:04 +08:00
Andrew Nicols 499f651729 MDL-75012 js: Full build of all grunt things 2023-03-02 12:15:25 +08:00
Andrew Nicols 0a95429dce MDL-75012 js: Bump Babel dependencies
Please note that whilst some dependencies have higher versions
available, these are not compatible at this time.
2023-03-02 12:15:25 +08:00
Andrew Nicols 35ef8a9e40 MDL-75012 js: Remove unused babel-preset-minify dependency 2023-03-02 12:15:25 +08:00
Jake Dallimore 51dae0b04e Merge branch 'MDL-77461-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2023-03-02 11:43:09 +08:00
Andrew Nicols bc41f92872 MDL-77461 behat: Use get_course_id instead of DB fetch 2023-03-02 11:07:39 +08:00
Jun Pataleta 430b3e7043 Merge branch 'MDL-77413-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-03-02 09:45:42 +08:00
AMOS bot f6debec437 Automatically generated installer lang files 2023-03-02 00:07:38 +00:00
Jun Pataleta c4d91b4e42 Merge branch 'MDL-77417_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2023-03-01 23:53:54 +08:00
Andrew Nicols 98317ff91a Merge branch 'MDL-72727-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-03-01 10:47:27 +08:00
AMOS bot 21c5f2d453 Automatically generated installer lang files 2023-03-01 00:07:32 +00:00
Andrew Nicols 42ec6014c4 Merge branch 'MDL-77097_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2023-02-28 22:34:30 +08:00
Angelia Dela Cruz 45b81544c5 MDL-77413 Behat: Minor changes to optimise the existing tests 2023-02-28 17:38:14 +08:00
Angelia Dela Cruz f055b84644 MDL-77413 Behat: Add coverage to verify groups can have a picture 2023-02-28 17:25:04 +08:00
Andrew Nicols 8d6e0dc416 MDL-75012 js: Put shifter on a diet
This commit switches to a new custom version of Shifter which sees it
put on a massive diet.

Many of the standard Shifter features are totally unused by Moodle, but
they add dependency spaghetti. Some of those dependencies will start to
cause us issues as they have not been updated for a very long time, are
no longer maintained, and are no longer compatible with anything
resembling a recent version of NodeJS.
2023-02-28 11:10:32 +08:00
Andrew Nicols 0ebccd5bb4 MDL-75012 js: Bump shifter to new version
This resolves an issue identified in 77083 which identified that GitHub
hashes shouldn't be treated as repeatable.

Whilst GitHub have reverted this change, it's still worth making this
change.
2023-02-28 11:10:32 +08:00
Andrew Nicols a22e2aa0d7 MDL-75012 js: Use our own jsdoc wrapper
grunt-jsdoc is abandoned and only works with an older version of jsdoc.

This is a very simple wrapper around jsdoc itself.
2023-02-28 11:10:32 +08:00
Andrew Nicols dfea25b3d7 MDL-75012 js: Audit fix 2023-02-28 11:10:32 +08:00
Andrew Nicols 173b61bf69 MDL-75012 js: Bump node-sass 2023-02-28 11:10:32 +08:00
Andrew Nicols c920bb6db5 MDL-75012 js: Update browserslist 2023-02-28 11:10:31 +08:00
Andrew Nicols 9899fc0a0f MDL-75012 js: Bump stylelint and components 2023-02-28 10:19:24 +08:00
Andrew Nicols d01eba812b MDL-75012 js: Remove grunt-contrib-uglify
We stopped using this when we updated our processes to support ESMs in
MDL-62497. Removal of the dependency was missed at the time.
2023-02-28 10:19:23 +08:00
Andrew Nicols 811526b0a6 MDL-75012 js: Bump standard dependencies
This change bumps dependencies which have no impact upon the build
process
2023-02-28 10:19:23 +08:00
Andrew Nicols fb8fa74655 MDL-75012 core: Bump NodeJS version requirements 2023-02-28 10:19:23 +08:00
Paul Holden 36e2f7d5a3 MDL-72727 mod_forum: prevent default favourite toggle click event.
Allow the repository call to the web service method to complete before
re-directing, otherwise the call may not complete and/or races against
the page reload causing random Behat errors.
2023-02-27 23:30:43 +00:00
Eloy Lafuente (stronk7) 4fa6354d89 MDL-77417 behat: behat_error_handler meets deprecation error types
Right now, any E_DEPRECATED, E_USER_DEPRECATED error type leads
to exception in behat runs, because the behat error handled is
not aware of them. See MDL-38041 for the initial implementation.

We don't want that to happen and they must behave like other "low"
error types (notices, warnings...), that will be reported in logs
or output, but won't trigger any exception, so the test can continue.

This commit just adds those 2 "new" error types to the handler,
providing the very same behaviour for them than the rest.
2023-02-27 09:38:37 +01:00
Eloy Lafuente (stronk7) 7ed2a79297 MDL-77097 store_mongodb: keep compatibility with PHP 7.4
Replaced 4 occurrences of get_debug_type() by gettype() to keep PHP 7.4 compatibility. Note this
has not been applied to 4.2dev and up because, there, it's safe to use get_debug_type().
2023-02-24 12:39:03 +01:00
Jun Pataleta 65731963bc weekly release 3.11.12+ 2023-02-24 15:43:36 +08:00
Jun Pataleta 63c6f278a7 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2023-02-24 15:43:33 +08:00
Matt Porritt 474ee8524a MDL-77376 Licensing: Update trademark.txt
Update Trademark policy in TRADEMARK.txt to
be in line with advice from the Moodle HQ
legal team
2023-02-24 12:36:43 +08:00
Andrew Nicols 5956302d76 Merge branch 'MDL-76843_311' of https://github.com/timhunt/moodle into MOODLE_311_STABLE 2023-02-23 11:54:21 +08:00
Andrew Nicols 9121d889f5 Merge branch 'MDL-77271-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-02-23 11:49:48 +08:00
Tim Hunt af0aee7d2a MDL-76843 questions behat: enhancements requried to test this issue
* New steps to set up certian sorts of broken test data.
* Fix qtype_essay_question::un_summarise_response().
2023-02-22 15:25:32 +00:00
Simey Lameze 76fc2573ce MDL-77271 behat: verify user licence preference is remembered 2023-02-22 09:31:04 +08:00
AMOS bot d611739b3f Automatically generated installer lang files 2023-02-21 00:07:30 +00:00
Ilya Tregubov f638a5bbae weekly release 3.11.12+ 2023-02-17 09:12:33 +08:00
Ilya Tregubov 2079ba1387 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2023-02-17 09:12:31 +08:00
AMOS bot c12e3b46de Automatically generated installer lang files 2023-02-17 00:07:43 +00:00
Andrew Nicols bdb1aefaad Merge branch 'MDL-76478-password-unmask-MOODLE_311_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_311_STABLE 2023-02-15 23:28:22 +08:00
Ilya Tregubov 6c48aaf4d9 Merge branch 'MDL-75230-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-02-15 16:13:32 +08:00
AMOS bot a745135867 Automatically generated installer lang files 2023-02-15 00:07:42 +00:00
Ilya Tregubov 2674350a47 Merge branch 'MDL-77189-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-02-13 13:44:38 +08:00
Simey Lameze 16cee3894e MDL-77189 behat: basic coverage for wikimedia repository 2023-02-13 13:24:03 +08:00
Paul Holden 5e943bf6ba weekly release 3.11.12+ 2023-02-10 13:47:41 +00:00
Angelia Dela Cruz 4d29785724 MDL-75230 behat: Lesson Behat tests optimised
Replace steps that manually add Lesson instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.
2023-02-10 17:44:33 +08:00
Andrew Nicols 733b90eef0 Merge branch 'MDL-76499-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-02-09 10:08:00 +08:00
Jun Pataleta 00385e7580 Merge branch 'MDL-74905_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2023-02-08 17:19:11 +08:00
Andrew Nicols 3b757a24eb Merge branch 'MDL-77123-311' of https://github.com/cameron1729/moodle into MOODLE_311_STABLE 2023-02-08 13:01:19 +08:00
Cameron Ball c56edaa116 MDL-77123 message_airnotifier: Don't test configured providers 2023-02-08 09:59:19 +08:00
Paul Holden 6b54bd46f2 Merge branch 'MDL-77078-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-02-06 13:33:09 +00:00
Angelia Dela Cruz 31f13cd315 MDL-76499 behat: Resource Behat tests optimised
Replace steps that manually add resource instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.

Co-authored-by: David Woloszyn <david.woloszyn@moodle.com>
2023-02-06 14:32:10 +08:00
Angelia Dela Cruz a45ccc464b MDL-77078 Behat: Coverage for assignment submission statement 2023-02-06 12:09:54 +08:00
Andrew Nicols 604d8c291f Merge branch 'MDL-76662-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-02-04 21:52:43 +08:00
Eloy Lafuente (stronk7) c5fdf320cd MDL-74905 ci: travis and gha, some adjustments
Apply for some of the improvements made for 4.2:
- Use our own moodlehq/mysql-action
- Define the tmpfs size and ensure that binlogs are disabled.
2023-02-03 19:48:15 +01:00
Eloy Lafuente (stronk7) 0fd5993afb MDL-74905 environment: Apply agreed changes:
- PHP 8.0 required.
- Moodle 3.11.8 required (first minor supporting PHP 8.0 officially).
- MySQL 8.0 required.
- MariaDB 10.6.7 required.
- PostgreSQL 13 required.
- php-sodium extension required.
- 64-bit PHP required.
2023-02-03 19:48:15 +01:00
Eloy Lafuente (stronk7) ec56eeb9a9 MDL-74905 environment: 4.2 base information
This is a direct copy of the 4.1 information, to
have all the real changes under control in next commit(s).
2023-02-03 19:48:15 +01:00
Jun Pataleta fa6c77adc7 weekly release 3.11.12+ 2023-02-03 15:43:46 +08:00
Andrew Nicols dca46bcab8 Merge branch 'MDL-75830-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-02-02 11:58:59 +08:00
Andrew Nicols cc045cc27d Merge branch 'MDL-76675_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2023-02-02 11:04:32 +08:00
Andrew Nicols 980a265718 Merge branch 'MDL-75912-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-02-02 09:45:03 +08:00
Angelia Dela Cruz 6ad9dcae1c MDL-75830 behat: Book behat tests optimised
Replace steps that manually add Book instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.
Additionally, performed Behat cleanup and optimisation to affected
files.
2023-02-02 09:01:01 +08:00
Paul Holden 2ebc453c99 Merge branch 'MDL-76658-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-02-01 16:34:45 +00:00
Ilya Tregubov 5cbd545cd3 Merge branch 'MDL-76587-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-02-01 13:26:58 +08:00
Angelia Dela Cruz e988445521 MDL-75912 behat: Wiki Behat tests optimised
Behat cleanup and optimisation
2023-02-01 11:32:00 +08:00
Angelia Dela Cruz b08f86b258 MDL-75912 behat: Wiki Behat tests now use generators
Replace steps that manually add Wiki instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.
2023-02-01 11:31:20 +08:00
Angelia Dela Cruz 58213db159 MDL-76658 Behat: Coverage for course cohort enrolment groups
Co-authored-by: Simey Lameze <simey@moodle.com>
2023-01-31 19:55:10 +08:00
Simey Lameze c34dc466b6 MDL-76587 behat: make grading page wider to avoid 'out of bounds' fail
This is because on classic theme the navigation block pushes the content
to the right and once behat changes the grades the 'Save changes' button
is no longer visible.
2023-01-31 11:21:20 +08:00
Andrew Nicols 2b7ede20b5 Merge branch 'MDL-77040-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-01-30 12:28:34 +08:00
Eloy Lafuente (stronk7) 4c64f49a88 MDL-76675 date: Only test all TZ names with PHPUNIT_LONGTEST enabled
It happens often that some timezone is renamed, split, added to the
IANAs list of timezones (that, for PHP is kept updated by the
php-timezonedb PECL extension).

When the information coming from the extension changes, all the
PHPUnit jobs in the world start failing (that's when CIs update
their PHP images, when devs update their packages, ...).

So, what we are doing here is to move that test that check for
every single string existing to be run only when PHPUNIT_LONGTEST
is enabled. That way only places running all tests will run that
one. And every other run just will skip it.

This corresponds to point 1 & 2 of the issue, lower impact in general
and, still be able to enable the tests to run.
2023-01-27 08:50:18 +01:00
Paul Holden 0baa1aa391 MDL-77040 core: assert types of returned Geoplugin data, not values.
The results we get from these tests are beyond our control, and are
unreliable for use in testing.

See also previous change 215cd2d8 in similar tests.
2023-01-26 13:24:16 +00:00
Paul Holden a9b87fa989 MDL-76662 tool_log: correct supported reports test assertions. 2023-01-26 13:09:02 +00:00
Sara Arjona cdcfb84d18 weekly release 3.11.12+ 2023-01-26 09:59:22 +01:00
Jun Pataleta 52046c52b1 Merge branch 'MDL-76977-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-01-25 16:09:47 +08:00
Jun Pataleta 9eccbb590e Merge branch 'MDL-77036-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-01-25 16:02:02 +08:00
Simey Lameze 2b7f887245 MDL-77036 core_iplookup: update test_ipv4 test expectations 2023-01-25 15:20:58 +08:00
Jun Pataleta 3dd63e8149 Merge branch 'MDL-76639-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-01-24 18:59:09 +08:00
Jun Pataleta 78e5dd6284 Merge branch 'MDL-76652-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-01-24 18:45:05 +08:00
Jun Pataleta f14dc52adc Merge branch 'MDL-76655-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2023-01-24 18:26:47 +08:00
Angelia Dela Cruz aab571ca2c MDL-76655 behat: Coverage for workshop grading strategies 2023-01-24 10:08:33 +08:00
Paul Holden eadfbd21e9 MDL-76977 phpunit: ensure unique data provider keys in mustache test. 2023-01-20 17:23:34 +00:00
Ilya Tregubov b5eb437fcd weekly release 3.11.12+ 2023-01-20 09:41:50 +08:00
Ilya Tregubov 16e5b999ce Merge branch 'MDL-76870-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2023-01-19 11:16:27 +08:00
Andrew Nicols 7d596ff339 Merge branch 'MDL-76841-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-01-19 08:55:45 +08:00
Andrew Nicols d02bcbb963 Merge branch 'MDL-70070-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2023-01-19 08:51:32 +08:00
Paul Holden c01344a0e7 MDL-76841 tool_mobile: improve potential config issues test.
Avoid certificate checking of the default test site (`example.com`),
and update the assertion so we get clearer failures in the future.
2023-01-16 08:30:31 +00:00
Paul Holden e9439d064b MDL-70070 phpunit: correct data provider method names.
They should not be prefixed `test_` because that's how actual
test methods containing assertions are identified by PHPUnit.
2023-01-16 08:28:19 +00:00
Simey Lameze 860bfb6f25 MDL-76870 question: change assertion to assertEqualsCanonicalizing
By using that assertion the arrays will be sorted before comparison
preventing any Oracle sorting related failures.

Credits for the solution go to Tim Hunt!
2023-01-13 18:13:27 +08:00
Angelia Dela Cruz 388c5731fa MDL-76639 behat: Add Behat test coverage for quiz with limited attempts 2023-01-13 16:32:58 +08:00
Simey Lameze e32d27e1ff MDL-76652 behat: use data generator and remove duplicated steps 2023-01-09 10:09:58 +08:00
Simey Lameze 2f826724c8 MDL-76652 behat: add coverage for postwithoutthrottling logic 2023-01-09 10:09:58 +08:00
Brendan Heywood 7f638dac59 MDL-76478 formslib: Fix autocomplete bug of existing passwords 2022-12-08 00:45:58 +11:00
143 changed files with 1790 additions and 1366 deletions
+3 -1
View File
@@ -66,7 +66,7 @@ jobs:
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: johanmeiring/mysql-action@tmpfs-patch
uses: moodlehq/mysql-action@v1
with:
collation server: utf8mb4_bin
mysql version: 5.7
@@ -74,6 +74,8 @@ jobs:
mysql user: test
mysql password: test
use tmpfs: true
tmpfs size: '1024M'
extra conf: --skip-log-bin
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
+3 -1
View File
@@ -81,7 +81,8 @@ install:
sudo service mysql stop
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
sudo service mysql restart
echo -e "[mysqld]\nskip-log-bin" | sudo tee -a /etc/mysql/my.cnf
sudo service mysql start
fi
- >
if [ "$DB" = 'pgsql' ];
@@ -92,6 +93,7 @@ install:
sudo mv /var/lib/postgresql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/postgresql /var/lib/postgresql
sudo service postgresql start 9.6
sh -c 'until pg_isready -p 5432; do echo "Waiting for the DB to be up..."; sleep 2; done'
fi
- >
if [ "$TASK" = 'PHPUNIT' ];
+53 -35
View File
@@ -1,48 +1,66 @@
MOODLE TRADEMARKS POLICY
========================
The word "Moodle" is trademarked in many countries around the world. The word
was originally coined as an acronym: Modular Object-Oriented Dynamic Learning
Environment. The trademark is owned by Martin Dougiamas, Founder and Director
of Moodle.
The Moodle Trademark
--------------------
The law obligates trademark owners to police their marks and prevent the use of
confusingly similar names by third parties. Through this policy wed like to
make it clear how Moodle-related projects, organisations, and people can use
the Moodle trademark. Wed also like to be clear about how use of the word is
restricted when used to promote commercial Moodle services. We do this to
protect the very business model that allows us to continue developing Moodle
for you.
The brand and word "Moodle" has trade mark protection in many countries around
the world. Various Moodle™ trade marks are owned by either Moodle Pty Ltd or
one of its associated entities. The law obligates trade mark owners to police
their trade marks and prevent the use of confusingly similar names by
third parties.
Allowed uses
------------
We have created a more concise and thorough set of Trademark Guidelines
(https://moodle.com/wp-content/uploads/2023/02/Moodle-Trademark-Guidelines-2023-4.pdf)
to help you understand how to comply with Moodle's trade mark requirements.
The Trademark Guidelines will also assist our Moodle Certified Partners and the
community to understand some of the principles that inform Moodle's stance
whenever potential infringement has been detected by us or our community.
The following uses dont require any permission at all:
We need to be clear about use of the word "Moodle" and how we restrict its use
when promoting commercial Moodle™ branded services. The proper use of
trade marks reliably assures consumers about the quality of the associated
products or services and where they have been derived from. Because the
Moodle LMS is made available under the open source GNU General Public License'
that permits you to modify the copyrighted software, the distribution of such
modified software in combination with Moodle trade marks can potentially
mislead others in the community. To be clear, the GNU GPL does not include an
implied right or licence to use Moodle's trade marks.
* Referring to the software or the Moodle project.
* Describing your own Moodle implementation (including within corporate
settings).
We do all this to protect the very business model that allows us to continue
developing various Moodle software solutions for you.
Allowed uses of "Moodle"
------------------------
The following uses don't require any permission at all:
* Referring to the software or the Moodle project as the "Moodle™ software"
or the "Moodle™ project"
* Describing your own implementation of the Moodle™ software platform
(including within corporate settings).
* Describing a Moodle-based community hub.
* Describing some software youve made that integrates with Moodle
(eg a Moodle integration feature on another system).
* Describing certain software you've made that integrates with Moodle
branded software (e.g. a Moodle integration feature on another system).
Restricted uses
---------------
Restricted uses of "Moodle"
---------------------------
The following uses are generally prohibited without explicit and direct
permission being granted to you by Moodle Pty Ltd. We do this to protect the
Moodle project from software and sites which could confuse people. Please
contact us to ask for permission in writing.
Moodle project from software and sites which could confuse people. If in
doubt, reach out for clarification at <trademarks@moodle.com>
* You cant use "Moodle" in the name of your software (including Mobile apps)
* You cant use "Moodle" in your company name
* You cant use "Moodle" in your domain name
* You cant use "Moodle" in advertising-related keywords (such as Adsense)
* You cant use "Moodle" to describe services around Moodle (such as hosting,
training, support, consulting, course creation services, theme development,
customisation, installation, integration and certification). This applies
even if you do not charge for the services. Note that usually only Moodle
Partners have this permission.
For information about the Moodle Partner Certification Mark as well as for how
to contact us, please see <https://moodle.com/trademarks/>.
* You can't use the word "Moodle" or any Moodle logos for commercial purposes
without prior written permission from Moodle HQ.
* You can't use "Moodle" in the name of your software (including Mobile apps).
* You can't use "Moodle" in your company name.
* You can't use "Moodle" in your domain name.
* You can't use "Moodle" in advertising-related keywords (such as Adsense).
* You can't use "Moodle" to describe services around Moodle
(such as hosting, training, support, consulting, course creation services,
theme development, customisation, installation, integration, analytics
and certification) that cause consumers to be confused that you are
associated with Moodle HQ if you are not.
This applies even if you do not charge for the services.
Note that usually only Moodle Partners have this permission.
+187
View File
@@ -3924,4 +3924,191 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.2" requires="3.11.8">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.6.7" />
<VENDOR name="mysql" version="8.0" />
<VENDOR name="postgres" version="13" />
<VENDOR name="mssql" version="14.0" />
<VENDOR name="oracle" version="19" />
</DATABASE>
<PHP version="8.0.0" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="required">
<FEEDBACK>
<ON_ERROR message="mbstringrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="required">
<FEEDBACK>
<ON_ERROR message="opensslrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="required">
<FEEDBACK>
<ON_ERROR message="intlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
<PHP_EXTENSION name="fileinfo" level="required"/>
<PHP_EXTENSION name="sodium" level="required"/>
<PHP_EXTENSION name="exif" level="optional"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
<FEEDBACK>
<ON_CHECK message="ishttpswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
<FEEDBACK>
<ON_CHECK message="incompleteunicodesupport" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
<FEEDBACK>
<ON_ERROR message="sixtyfourbitsrequired" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
<FEEDBACK>
<ON_CHECK message="iscustomadminwarnings" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
@@ -30,10 +30,9 @@ Feature: Verify that all form fields values can be get and set
| student2 | G2 |
| student3 | G2 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage
| activity | course | idnumber | name | firstpagetitle | wikimode | visible |
| wiki | C1 | wiki1 | Test this one | Test this one | collaborative | 0 |
And I am on the "Course 1" course page logged in as admin
And I navigate to "Reset" in current page administration
# Select (multi-select) - Checking "the select box should contain".
And I expand all fieldsets
@@ -61,16 +60,14 @@ Feature: Verify that all form fields values can be get and set
# Checkbox - Checking "I set the field" and "The field matches value" ticked.
And I set the field "Force format" to "1"
And I press "Save and return to course"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I am on the "Test this one" "wiki activity editing" page
And I expand all fieldsets
And the field "Force format" matches value "1"
And the field "Force format" does not match value ""
# Checkbox - Checking "I set the field" and "The field matches value" unticked.
And I set the field "Force format" to ""
And I press "Save and return to course"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I am on the "Test this one" "wiki activity editing" page
And I expand all fieldsets
And the field "Force format" matches value ""
And the field "Force format" does not match value "1"
@@ -78,8 +75,7 @@ Feature: Verify that all form fields values can be get and set
And I set the following fields to these values:
| Force format | 1 |
And I press "Save and return to course"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I am on the "Test this one" "wiki activity editing" page
And I expand all fieldsets
And the following fields match these values:
| Force format | 1 |
@@ -89,8 +85,7 @@ Feature: Verify that all form fields values can be get and set
And I set the following fields to these values:
| Force format | |
And I press "Save and return to course"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I am on the "Test this one" "wiki activity editing" page
And I expand all fieldsets
And the following fields match these values:
| Force format | |
@@ -143,10 +138,11 @@ Feature: Verify that all form fields values can be get and set
And I navigate to "Edit settings" in current page administration
And the field "Course ID number" matches value "Course id number"
Scenario: with JS disabled all form fields getters and setters works as expected
@javascript
Scenario: with JS enabled all form fields getters and setters works as expected
Given the following "activities" exist:
| activity | course | name |
| lesson | C1 | Test lesson |
Then I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
@@ -159,11 +155,8 @@ Feature: Verify that all form fields values can be get and set
And the "members" select box should contain "Student 2 (s2@example.com)"
And the "members" select box should not contain "Student 3 (s3@example.com)"
# Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values".
And I am on "Course 1" course homepage
And I add a "Lesson" to section "1"
And I am on the "Test lesson" "lesson activity editing" page
And I set the following fields to these values:
| Name | Test lesson |
| Description | Test lesson description |
| available[enabled] | 1 |
And I set the field "deadline[enabled]" to "1"
# Checkbox (AJAX) - Checking "the field matches value" before saving.
@@ -33,3 +33,27 @@ Feature: Licence manager
And "This is the site default licence" "icon" should exist in the "cc" "table_row"
And "Enable licence" "icon" should not exist in the "cc" "table_row"
And "This is the site default licence" "icon" should not exist in the "public" "table_row"
@javascript @_file_upload
Scenario Outline: User licence preference is remembered depending of setting value
Given the following config values are set as admin:
| sitedefaultlicense | cc |
| rememberuserlicensepref | <rememberuserlicensepref> |
And I log in as "admin"
And I follow "Manage private files..."
And I follow "Add..."
And I follow "Upload a file"
And the field with xpath "//select[@name='license']" matches value "Creative Commons"
And I click on "Close" "button" in the "File picker" "dialogue"
When I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager as:
| Save as | empty_copy.txt |
| license | Public domain |
And I press "Save changes"
And I follow "Manage private files..."
And I follow "Add..."
Then the field with xpath "//select[@name='license']" matches value "<expectedlicence>"
Examples:
| rememberuserlicensepref | expectedlicence |
| 0 | Creative Commons |
| 1 | Public domain |
@@ -33,8 +33,7 @@ class store_test extends \advanced_testcase {
* Tests log writing.
*
* @param bool $jsonformat True to test with JSON format
* @dataProvider test_log_writing_provider
* @throws moodle_exception
* @dataProvider log_writing_provider
*/
public function test_log_writing(bool $jsonformat) {
global $DB, $CFG;
@@ -252,9 +251,9 @@ class store_test extends \advanced_testcase {
* Returns different JSON format settings so the test can be run with JSON format either on or
* off.
*
* @return [bool] Array of true/false
* @return bool[] Array of true/false
*/
public static function test_log_writing_provider(): array {
public static function log_writing_provider(): array {
return [
[false],
[true]
@@ -311,17 +310,16 @@ class store_test extends \advanced_testcase {
$logmanager = get_log_manager();
$allreports = \core_component::get_plugin_list('report');
$supportedreports = array(
'report_log' => '/report/log',
'report_loglive' => '/report/loglive'
);
// Make sure all supported reports are installed.
$expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
$reports = $logmanager->get_supported_reports('logstore_database');
$reports = array_keys($reports);
$expectedreports = array_intersect_key([
'log' => 'report_log',
'loglive' => 'report_loglive',
], $allreports);
$supportedreports = $logmanager->get_supported_reports('logstore_database');
foreach ($expectedreports as $expectedreport) {
$this->assertContains($expectedreport, $reports);
$this->assertArrayHasKey($expectedreport, $supportedreports);
}
}
}
@@ -217,20 +217,19 @@ class store_test extends \advanced_testcase {
$logmanager = get_log_manager();
$allreports = \core_component::get_plugin_list('report');
$supportedreports = array(
'report_log' => '/report/log',
'report_loglive' => '/report/loglive',
'report_outline' => '/report/outline',
'report_participation' => '/report/participation',
'report_stats' => '/report/stats'
);
// Make sure all supported reports are installed.
$expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
$reports = $logmanager->get_supported_reports('logstore_legacy');
$reports = array_keys($reports);
$expectedreports = array_intersect_key([
'log' => 'report_log',
'loglive' => 'report_loglive',
'outline' => 'report_outline',
'participation' => 'report_participation',
'stats' => 'report_stats'
], $allreports);
$supportedreports = $logmanager->get_supported_reports('logstore_legacy');
foreach ($expectedreports as $expectedreport) {
$this->assertContains($expectedreport, $reports);
$this->assertArrayHasKey($expectedreport, $supportedreports);
}
}
@@ -38,8 +38,7 @@ class store_test extends \advanced_testcase {
* Tests log writing.
*
* @param bool $jsonformat True to test with JSON format
* @dataProvider test_log_writing_provider
* @throws moodle_exception
* @dataProvider log_writing_provider
*/
public function test_log_writing(bool $jsonformat) {
global $DB;
@@ -223,9 +222,9 @@ class store_test extends \advanced_testcase {
* Returns different JSON format settings so the test can be run with JSON format either on or
* off.
*
* @return [bool] Array of true/false
* @return bool[] Array of true/false
*/
public static function test_log_writing_provider(): array {
public static function log_writing_provider(): array {
return [
[false],
[true]
@@ -239,20 +238,19 @@ class store_test extends \advanced_testcase {
$logmanager = get_log_manager();
$allreports = \core_component::get_plugin_list('report');
$supportedreports = array(
'report_log' => '/report/log',
'report_loglive' => '/report/loglive',
'report_outline' => '/report/outline',
'report_participation' => '/report/participation',
'report_stats' => '/report/stats'
);
// Make sure all supported reports are installed.
$expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
$reports = $logmanager->get_supported_reports('logstore_standard');
$reports = array_keys($reports);
$expectedreports = array_intersect_key([
'log' => 'report_log',
'loglive' => 'report_loglive',
'outline' => 'report_outline',
'participation' => 'report_participation',
'stats' => 'report_stats'
], $allreports);
$supportedreports = $logmanager->get_supported_reports('logstore_standard');
foreach ($expectedreports as $expectedreport) {
$this->assertContains($expectedreport, $reports);
$this->assertArrayHasKey($expectedreport, $supportedreports);
}
}
@@ -368,7 +366,7 @@ class store_test extends \advanced_testcase {
* Tests the decode_other function can cope with both JSON and PHP serialized format.
*
* @param mixed $value Value to encode and decode
* @dataProvider test_decode_other_provider
* @dataProvider decode_other_provider
*/
public function test_decode_other($value) {
$this->assertEquals($value, \logstore_standard\log\store::decode_other(serialize($value)));
@@ -387,7 +385,7 @@ class store_test extends \advanced_testcase {
*
* @return array Array of parameters
*/
public function test_decode_other_provider(): array {
public function decode_other_provider(): array {
return [
[['info' => 'd2819896', 'logurl' => 'discuss.php?d=2819896']],
[null],
@@ -400,8 +398,7 @@ class store_test extends \advanced_testcase {
* Checks that backup and restore of log data works correctly.
*
* @param bool $jsonformat True to test with JSON format
* @dataProvider test_log_writing_provider
* @throws moodle_exception
* @dataProvider log_writing_provider
*/
public function test_backup_restore(bool $jsonformat) {
global $DB;
+11 -7
View File
@@ -59,22 +59,26 @@ class api_test extends \externallib_advanced_testcase {
*/
public function test_get_potential_config_issues() {
global $CFG;
require_once($CFG->dirroot . '/message/lib.php');
$this->resetAfterTest(true);
$this->setAdminUser();
$CFG->userquota = '73289234723498234723423489273423497234234';
// Set non-SSL wwwroot, to avoid spurious certificate checking.
$CFG->wwwroot = 'http://www.example.com';
$CFG->debugdisplay = 1;
set_config('debugauthdb', 1, 'auth_db');
set_config('debugdb', 1, 'enrol_database');
$expectedissues = array('adodbdebugwarning', 'displayerrorswarning');
// Get potential issues, obtain their keys for comparison.
$issues = api::get_potential_config_issues();
$this->assertCount(count($expectedissues), $issues);
foreach ($issues as $issue) {
$this->assertTrue(in_array($issue[0], $expectedissues));
}
$issuekeys = array_column($issues, 0);
$this->assertEqualsCanonicalizing([
'nohttpsformobilewarning',
'adodbdebugwarning',
'displayerrorswarning',
], $issuekeys);
}
/**
@@ -152,14 +152,11 @@ Feature: Apply tour filters to a tour
| fullname | shortname | format | enablecompletion |
| Course 1 | C1 | topics | 1 |
| Course 2 | C2 | topics | 1 |
And the following "activities" exist:
| activity | course | name | firstpagetitle | wikimode |
| wiki | C1 | Test wiki name | First page | collaborative |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Wiki" to section "1" and I fill the form with:
| Wiki name | Test wiki name |
| Description | Test wiki description |
| First page name | First page |
| Wiki mode | Collaborative wiki |
And I am on "Course 2" course homepage
And I am on "Course 2" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
@@ -378,7 +378,7 @@ class condition_test extends \advanced_testcase {
/**
* Tests the is_available and get_description functions for previous activity option.
*
* @dataProvider test_previous_activity_data
* @dataProvider previous_activity_data
* @param int $grade the current assign grade (0 for none)
* @param int $condition true for complete, false for incomplete
* @param string $mark activity to mark as complete
@@ -467,7 +467,7 @@ class condition_test extends \advanced_testcase {
$this->assertMatchesRegularExpression($description, $information);
}
public function test_previous_activity_data(): array {
public function previous_activity_data(): array {
// Assign grade, condition, activity to complete, activity to test, result, resultnot, description.
return [
'Missing previous activity complete' => [
@@ -559,7 +559,7 @@ class condition_test extends \advanced_testcase {
* Tests the is_available and get_description functions for
* previous activity option in course sections.
*
* @dataProvider test_section_previous_activity_data
* @dataProvider section_previous_activity_data
* @param int $condition condition value
* @param bool $mark if Page 1 must be mark as completed
* @param string $section section to add the availability
@@ -632,7 +632,7 @@ class condition_test extends \advanced_testcase {
}
public function test_section_previous_activity_data(): array {
public function section_previous_activity_data(): array {
return [
// Condition, Activity completion, section to test, result, resultnot, description.
'Completion complete Section with no previous activity' => [
@@ -197,7 +197,12 @@ class condition extends \core_availability\condition {
$this->customfield);
}
} else {
$translatedfieldname = \core_user\fields::get_display_name($this->standardfield);
$standardfields = self::get_standard_profile_fields();
if (array_key_exists($this->standardfield, $standardfields)) {
$translatedfieldname = $standardfields[$this->standardfield];
} else {
$translatedfieldname = get_string('missing', 'availability_profile', $this->standardfield);
}
}
$a = new \stdClass();
// Not safe to call format_string here; use the special function to call it later.
@@ -321,6 +326,27 @@ class condition extends \core_availability\condition {
return $fieldconditionmet;
}
/**
* Return list of standard user profile fields used by the condition
*
* @return string[]
*/
public static function get_standard_profile_fields(): array {
return [
'firstname' => \core_user\fields::get_display_name('firstname'),
'lastname' => \core_user\fields::get_display_name('lastname'),
'email' => \core_user\fields::get_display_name('email'),
'city' => \core_user\fields::get_display_name('city'),
'country' => \core_user\fields::get_display_name('country'),
'idnumber' => \core_user\fields::get_display_name('idnumber'),
'institution' => \core_user\fields::get_display_name('institution'),
'department' => \core_user\fields::get_display_name('department'),
'phone1' => \core_user\fields::get_display_name('phone1'),
'phone2' => \core_user\fields::get_display_name('phone2'),
'address' => \core_user\fields::get_display_name('address'),
];
}
/**
* Gets data about custom profile fields. Cached statically in current
* request.
@@ -472,6 +498,11 @@ class condition extends \core_availability\condition {
$valuefield = 'data';
$default = $customfield->defaultdata;
} else {
$standardfields = self::get_standard_profile_fields();
if (!array_key_exists($this->standardfield, $standardfields)) {
// If the field isn't found, nobody matches.
return [];
}
$values = $DB->get_records_select('user', 'id ' . $sql, $params,
'', 'id, '. $this->standardfield);
$valuefield = $this->standardfield;
@@ -595,6 +626,11 @@ class condition extends \core_availability\condition {
$where = "(ud.data IS NOT NULL AND $condition)";
}
} else {
$standardfields = self::get_standard_profile_fields();
if (!array_key_exists($this->standardfield, $standardfields)) {
// If the field isn't found, nobody matches.
return ['SELECT id FROM {user} WHERE 0 = 1', []];
}
$tablesql = "JOIN {user} u ON u.id = userids.id";
list ($where, $mainparams) = $this->get_condition_sql(
'u.' . $this->standardfield);
@@ -42,20 +42,9 @@ class frontend extends \core_availability\frontend {
protected function get_javascript_init_params($course, \cm_info $cm = null,
\section_info $section = null) {
// Standard user fields.
$standardfields = array(
'firstname' => \core_user\fields::get_display_name('firstname'),
'lastname' => \core_user\fields::get_display_name('lastname'),
'email' => \core_user\fields::get_display_name('email'),
'city' => \core_user\fields::get_display_name('city'),
'country' => \core_user\fields::get_display_name('country'),
'idnumber' => \core_user\fields::get_display_name('idnumber'),
'institution' => \core_user\fields::get_display_name('institution'),
'department' => \core_user\fields::get_display_name('department'),
'phone1' => \core_user\fields::get_display_name('phone1'),
'phone2' => \core_user\fields::get_display_name('phone2'),
'address' => \core_user\fields::get_display_name('address')
);
$standardfields = condition::get_standard_profile_fields();
\core_collator::asort($standardfields);
// Custom fields.
@@ -39,7 +39,7 @@ $string['requires_notendswith'] = 'Your <strong>{$a->field}</strong> does not en
$string['requires_notisequalto'] = 'Your <strong>{$a->field}</strong> is not <strong>{$a->value}</strong>';
$string['requires_notstartswith'] = 'Your <strong>{$a->field}</strong> does not start with <strong>{$a->value}</strong>';
$string['requires_startswith'] = 'Your <strong>{$a->field}</strong> starts with <strong>{$a->value}</strong>';
$string['missing'] = '(Missing custom field: {$a})';
$string['missing'] = '(Missing field: {$a})';
$string['title'] = 'User profile';
$string['op_contains'] = 'contains';
$string['op_doesnotcontain'] = 'doesn\'t contain';
+7 -10
View File
@@ -15,16 +15,13 @@ Feature: Block appearances
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | description | course | idnumber | section | template |
| survey | Test survey name | | C1 | survey1 | 1 | 4 |
| book | Test book name | Test book description | C1 | book1 | 1 | |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test book name"
And I set the following fields to these values:
| Chapter title | Book title |
| Content | Book content test test |
And I press "Save changes"
| activity | name | course | idnumber | section | template |
| survey | Test survey name | C1 | survey1 | 1 | 4 |
| book | Test book name | C1 | book1 | 1 | |
And the following "mod_book > chapter" exists:
| book | Test book name |
| title | Book title |
| content | Book content test test |
And I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I add the "Comments" block
+5 -11
View File
@@ -17,17 +17,11 @@ Feature: Block region moving
And the following "activities" exist:
| activity | name | course | template |
| survey | Test survey name | C1 | 4 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book name |
| Description | Test book description |
And I follow "Test book name"
And I set the following fields to these values:
| Chapter title | Book title |
| Content | Book content test test |
And I press "Save changes"
And I log out
| book | Test book name | C1 | |
And the following "mod_book > chapter" exists:
| book | Test book name |
| title | Book title |
| content | Book content test test |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Comments" block
@@ -20,7 +20,7 @@ namespace MongoDB\Exception;
use MongoDB\Driver\Exception\InvalidArgumentException as DriverInvalidArgumentException;
use function array_pop;
use function count;
use function get_debug_type;
use function gettype;
use function implode;
use function is_array;
use function sprintf;
@@ -56,6 +56,6 @@ class InvalidArgumentException extends DriverInvalidArgumentException implements
$expectedType = $typeString;
}
return new static(sprintf('Expected %s to have type "%s" but found "%s"', $name, $expectedType, get_debug_type($value)));
return new static(sprintf('Expected %s to have type "%s" but found "%s"', $name, $expectedType, gettype($value)));
}
}
@@ -17,7 +17,7 @@
namespace MongoDB\Exception;
use function get_debug_type;
use function gettype;
use function sprintf;
class ResumeTokenException extends RuntimeException
@@ -30,7 +30,7 @@ class ResumeTokenException extends RuntimeException
*/
public static function invalidType($value)
{
return new static(sprintf('Expected resume token to have type "array or object" but found "%s"', get_debug_type($value)));
return new static(sprintf('Expected resume token to have type "array or object" but found "%s"', gettype($value)));
}
/**
+4
View File
@@ -10,3 +10,7 @@ Import procedure:
- Check the minim php driver version in https://docs.mongodb.com/drivers/php#compatibility and change the value in the "are_requirements_met" method if necessary.
This version (1.8.0) requires PHP mongodb extension >= 1.8.0
Local changes:
- Replaced 4 occurrences of get_debug_type() by gettype() to keep PHP 7.4 compatibility. Note this
has not been applied to 4.2dev and up because, there, it's safe to use get_debug_type().
+5 -5
View File
@@ -2624,7 +2624,7 @@ class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
public function test_get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
public function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
@@ -2639,7 +2639,7 @@ class externallib_test extends externallib_advanced_testcase {
* Prevent user from reading other user's event.
*
* @covers \core_calendar_external::get_calendar_event_by_id
* @dataProvider test_get_calendar_event_by_id_prevent_read_other_users_events_data_provider
* @dataProvider get_calendar_event_by_id_prevent_read_other_users_events_data_provider
*
* @param bool $isadminevent Is admin's event
* @param bool $isadmin Is current user admin user
@@ -2695,7 +2695,7 @@ class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
public function test_edit_or_delete_other_users_events_data_provider(): array {
public function edit_or_delete_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
@@ -2709,7 +2709,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Test the behavior of deleting other users' user events.
*
* @dataProvider test_edit_or_delete_other_users_events_data_provider
* @dataProvider edit_or_delete_other_users_events_data_provider
* @covers \core_calendar_external::delete_calendar_events
* @param bool $isadmin Whether the current user is admin.
* @param bool $isadminevent Whether it's an admin event or not.
@@ -2756,7 +2756,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Test the behavior of editing other users' user events
*
* @dataProvider test_edit_or_delete_other_users_events_data_provider
* @dataProvider edit_or_delete_other_users_events_data_provider
* @covers \core_calendar_external::submit_create_update_form
* @param bool $isadmin Whether the current user is admin.
* @param bool $isadminevent Whether it's an admin event or not.
+6 -6
View File
@@ -49,7 +49,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test proxying.
*
* @dataProvider test_proxy_testcases()
* @dataProvider proxy_testcases
* @param int $id Object ID.
* @param string $member Object member to retrieve.
* @param mixed $expected Expected value of member.
@@ -65,7 +65,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test setting values with a base class.
*
* @dataProvider test_proxy_testcases()
* @dataProvider proxy_testcases
* @param int $id Object ID.
* @param string $member Object member to retrieve.
* @param mixed $storedvalue Value as would be stored externally.
@@ -86,7 +86,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test getting a non existant member.
*
* @dataProvider test_get_set_testcases()
* @dataProvider get_set_testcases
* @param int $id ID of the object being proxied.
*/
public function test_get_invalid_member($id) {
@@ -101,7 +101,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test get proxied instance.
*
* @dataProvider test_get_set_testcases()
* @dataProvider get_set_testcases
* @param int $id Object ID.
*/
public function test_get_proxied_instance($id) {
@@ -115,7 +115,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test cases for proxying test.
*/
public function test_proxy_testcases() {
public function proxy_testcases() {
return [
'Object 1 member 1' => [
1,
@@ -153,7 +153,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test cases for getting and setting tests.
*/
public function test_get_set_testcases() {
public function get_set_testcases() {
return [
'Object 1' => [1],
'Object 2' => [5]
@@ -14,7 +14,7 @@ Feature: Sections can be edited and deleted in topics format
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| assign | Test assignment name | Test assignment description | C1 | assign1 | 0 |
| book | Test book name | Test book description | C1 | book1 | 1 |
| book | Test book name | | C1 | book1 | 1 |
| chat | Test chat name | Test chat description | C1 | chat1 | 4 |
| choice | Test choice name | Test choice description | C1 | choice1 | 5 |
And the following "course enrolments" exist:
@@ -14,7 +14,7 @@ Feature: Sections can be edited and deleted in weeks format
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| assign | Test assignment name | Test assignment description | C1 | assign1 | 0 |
| book | Test book name | Test book description | C1 | book1 | 1 |
| book | Test book name | | C1 | book1 | 1 |
| chat | Test chat name | Test chat description | C1 | chat1 | 4 |
| choice | Test choice name | Test choice description | C1 | choice1 | 5 |
And the following "course enrolments" exist:
+80
View File
@@ -0,0 +1,80 @@
@core @core_course
Feature: Teacher can change the course format
In order to change course format
As a teacher
I should be able to edit a course
@javascript
Scenario: Teacher can change the course format
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
# Course format is initially set to Topics format
And the following "courses" exist:
| fullname | shortname | format | startdate |
| Course 1 | C1 | topics | ## 1 day ago ## |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
# Confirm that course format is Topics
When I am on the "Course 1" course page logged in as teacher1
Then I should see "Topic 1"
And I am on the "Course 1" "course editing" page
And I expand all fieldsets
# Fields that appear for Topics format exist
# Also confirm contents of Hidden sections and Course layout select box
And I should see "Hidden sections"
And the "Hidden sections" select box should contain "Hidden sections are shown in collapsed form"
And the "Hidden sections" select box should contain "Hidden sections are completely invisible"
# Hidden sections default value is 0 (Hidden sections are shown in collapsed form)
And the field "Hidden sections" matches value "0"
And I should see "Course layout"
And the "Course layout" select box should contain "Show all sections on one page"
And the "Course layout" select box should contain "Show one section per page"
# Course layout default value is 0 (Show all sections on one page)
And the field "Course layout" matches value "0"
# Set course format to Single activity format
And I set the field "Format" to "Single activity format"
And I expand all fieldsets
# Confirm that fields that appear for Single activity format appears
And I should see "Type of activity"
And I set the field "Type of activity" to "Glossary"
And I press "Save and display"
And I set the field "Name" to "Glossary 1"
And I press "Save and display"
# Confirm that course page displays single activity of type Glossary
And I should see "Browse the glossary using this index"
And I should not see "Topic 1"
And I am on the "Course 1" "course editing" page
And I expand all fieldsets
# Set course format to Weekly format
And I set the field "Format" to "Weekly format"
And I expand all fieldsets
# Confirm that fields that appear for Weekly format appears
# Also confirm contents of Hidden sections and Course layout select box
And I should see "Hidden sections"
And the "Hidden sections" select box should contain "Hidden sections are shown in collapsed form"
And the "Hidden sections" select box should contain "Hidden sections are completely invisible"
# Hidden sections default value is 0 (Hidden sections are shown in collapsed form)
And the field "Hidden sections" matches value "0"
And I should see "Course layout"
And the "Course layout" select box should contain "Show all sections on one page"
And the "Course layout" select box should contain "Show one section per page"
# Course layout default value is 0 (Show all sections on one page)
And the field "Course layout" matches value "0"
And I press "Save and display"
# Confirm that course page displays weekly sections
And I should see "This week"
And I should not see "Browse the glossary using this index"
And I am on the "Course 1" "course editing" page
And I expand all fieldsets
# Set course format to Social format
And I set the field "Format" to "Social format"
# Confirm that fields that appear for Social format appears
And I expand all fieldsets
And I should see "Number of discussions"
And the field "Number of discussions" matches value "10"
And I press "Save and display"
# Confirm that course page displays a forum
And I should see "There are no discussion topics yet in this forum"
And I should not see "This week"
@@ -0,0 +1,81 @@
@enrol @enrol_cohort
Feature: Cohort enrolment management
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher001 | Teacher | 001 | teacher001@example.com |
| s1 | Sandra | Cole | s1@example.com |
| s2 | John | Smith | s2@example.com |
| s4 | Jane | Doe | s4@example.com |
| s3 | Bianca | McAfee | s3@example.com |
| s5 | Abigail | Wyatt | s5@example.com |
And the following "cohorts" exist:
| name | idnumber | visible | Context |
| Alpha1 | A1 | 1 | 3 |
| Beta2 | B1 | 1 | 3 |
And the following "courses" exist:
| fullname | shortname | format | startdate |
| Course 001 | C001 | weeks | ##1 month ago## |
And the following "course enrolments" exist:
| user | course | role | timestart |
| teacher001 | C001 | editingteacher | ##1 month ago## |
And the following "cohort members" exist:
| user | cohort |
| s1 | A1 |
| s2 | A1 |
| s3 | B1 |
| s5 | B1 |
And I am on the "Course 001" course page logged in as teacher001
@javascript
Scenario: Add groups in the course cohort enrolment
When I add "Cohort sync" enrolment method with:
| Cohort | A1 |
| customint2 | -1 |
Then I should see "Cohort sync (Alpha1 - Student)"
And I am on "Course 001" course homepage
And I navigate to "Users > Groups" in current page administration
# Confirm that group was created and corresponding group members are present
And I set the field "groups[]" to "Alpha1 cohort (2)"
And the "members" select box should contain "Sandra Cole (s1@example.com)"
And the "members" select box should contain "John Smith (s2@example.com)"
And I log in as "admin"
And I navigate to "Users > Accounts > Cohorts" in site administration
And I click on "Assign" "link" in the "Alpha1" "table_row"
And I should see "Cohort 'Alpha1' members"
And I should see "Removing users from a cohort may result in unenrolling of users from multiple courses which includes deleting of user settings, grades, group membership and other user information from affected courses."
# Remove user s4 from cohort
And I set the field "removeselect[]" to "John Smith (s2@example.com)"
And I click on "Remove" "button"
# Add user s4 to the cohort.
And I set the field "addselect_searchtext" to "s4"
And I set the field "addselect[]" to "Jane Doe (s4@example.com)"
And I click on "Add" "button"
And the "removeselect[]" select box should contain "Sandra Cole (s1@example.com)"
And the "removeselect[]" select box should contain "Jane Doe (s4@example.com)"
And the "removeselect[]" select box should not contain "John Smith (s2@example.com)"
And I trigger cron
And I am on "Course 001" course homepage
And I navigate to course participants
# Verifies students 1 and 4 are in the cohort and student 2 is not any more.
And the following should exist in the "participants" table:
| First name / Last name | Email address | Roles | Groups |
| Sandra Cole | s1@example.com | Student | Alpha1 cohort |
| Jane Doe | s4@example.com | Student | Alpha1 cohort |
And the following should not exist in the "participants" table:
| First name / Last name | Email address | Roles | Groups |
| John Smith | s2@example.com | Student | Alpha1 cohort |
@javascript
Scenario: Course cohort enrolment creates a new group
When I add "Cohort sync" enrolment method with:
| Cohort | B1 |
And I click on "Edit" "link" in the "Beta2" "table_row"
And I set the field "Add to group" to "Create new group"
And I click on "Save changes" "button"
And I am on "Course 001" course homepage
And I navigate to "Users > Groups" in current page administration
And I set the field "groups[]" to "Beta2 cohort (2)"
Then the "members" select box should contain "Bianca McAfee (s3@example.com)"
And the "members" select box should contain "Abigail Wyatt (s5@example.com)"
@@ -26,9 +26,8 @@ Feature: Add a new custom file type
| Custom description | Moodle rules |
And I press "Save changes"
And I should see "application/x-moodle-rules"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
When I add a "File" to section "1" and I fill the form with:
| Name | Test file |
| Select files | files/tests/fixtures/custom_filetype.mdlr |
+1 -1
View File
@@ -238,7 +238,7 @@ class filter_algebra extends moodle_text_filter {
$DB->insert_record("cache_filters", $texcache, false);
$text = str_replace( $matches[0][$i], filter_algebra_image($filename, $texexp, '', '', $align), $text);
} else {
$text = str_replace( $matches[0][$i],"<b>Undetermined error:</b> ",$text);
$text = str_replace( $matches[0][$i],"<b>Undetermined error:</b> " . $matches[0][$i], $text);
}
} else {
$text = str_replace( $matches[0][$i], filter_algebra_image($filename, $texcache->rawtext), $text);
+1 -1
View File
@@ -123,7 +123,7 @@ class filter_data extends moodle_text_filter {
usort($contents, 'filter_data::sort_entries_by_length');
foreach ($contents as $content) {
$href_tag_begin = '<a class="data autolink dataid'.$content->dataid.'" title="'.$content->content.'" '.
$href_tag_begin = '<a class="data autolink dataid'.$content->dataid.'" title="'.s($content->content).'" '.
'href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$content->dataid.
'&amp;rid='.$content->recordid.'">';
$contentlist[] = new filterobject($content->content, $href_tag_begin, '</a>', false, true);
+4 -11
View File
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides the {@link filter_mathjaxloader_filter_testcase} class.
*
* @package filter_mathjaxloader
* @category test
* @copyright 2017 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace filter_mathjaxloader;
use filter_mathjaxloader;
@@ -35,6 +26,8 @@ require_once($CFG->dirroot.'/filter/mathjaxloader/filter.php');
/**
* Unit tests for the MathJax loader filter.
*
* @package filter_mathjaxloader
* @category test
* @copyright 2017 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,7 +39,7 @@ class filter_test extends \advanced_testcase {
* @param string $moodlelangcode the user's current language
* @param string $mathjaxlangcode the mathjax language to be used for the moodle language
*
* @dataProvider test_map_language_code_expected_mappings
* @dataProvider map_language_code_expected_mappings
*/
public function test_map_language_code($moodlelangcode, $mathjaxlangcode) {
@@ -59,7 +52,7 @@ class filter_test extends \advanced_testcase {
*
* @return array of [moodlelangcode, mathjaxcode] tuples
*/
public function test_map_language_code_expected_mappings() {
public function map_language_code_expected_mappings() {
return [
['cz', 'cs'], // Explicit mapping.
@@ -38,7 +38,7 @@ class filtermath_test extends \advanced_testcase {
* @param string $inputtext The text given by the user.
* @param string $expected The expected output after filtering.
*
* @dataProvider test_math_filtering_inputs
* @dataProvider math_filtering_inputs
*/
public function test_math_filtering($inputtext, $expected) {
$filter = new filter_mathjaxloader(\context_system::instance(), []);
@@ -50,7 +50,7 @@ class filtermath_test extends \advanced_testcase {
*
* @return array of [inputtext, expectedoutput] tuples.
*/
public function test_math_filtering_inputs() {
public function math_filtering_inputs() {
return [
// One inline formula.
['Some inline math \\( y = x^2 \\).',
@@ -27,6 +27,7 @@ namespace gradereport_history\output;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/tablelib.php');
require_once($CFG->dirroot . '/user/lib.php');
/**
* Renderable class for gradehistory report.
@@ -53,6 +54,11 @@ class tablelog extends \table_sql implements \renderable {
*/
protected $filters;
/**
* @var \stdClass[] List of users included in the report (if userids are specified as filters)
*/
protected $users = [];
/**
* @var array A list of grade items present in the course.
*/
@@ -99,7 +105,6 @@ class tablelog extends \table_sql implements \renderable {
$this->courseid = $this->context->instanceid;
$this->pagesize = $perpage;
$this->page = $page;
$this->filters = (object)$filters;
$this->gradeitems = \grade_item::fetch_all(array('courseid' => $this->courseid));
$this->cms = get_fast_modinfo($this->courseid);
$this->useridfield = 'userid';
@@ -108,6 +113,9 @@ class tablelog extends \table_sql implements \renderable {
// Define columns in the table.
$this->define_table_columns();
// Define filters.
$this->define_table_filters((object) $filters);
// Define configs.
$this->define_table_configs($url);
@@ -136,6 +144,36 @@ class tablelog extends \table_sql implements \renderable {
$this->no_sorting('grader');
}
/**
* Define table filters
*
* @param \stdClass $filters
*/
protected function define_table_filters(\stdClass $filters): void {
global $DB;
$this->filters = $filters;
if (!empty($this->filters->userids)) {
$course = get_course($this->courseid);
// Retrieve userids that are part of the filters object, and ensure user can access each of them.
[$userselect, $userparams] = $DB->get_in_or_equal(explode(',', $this->filters->userids), SQL_PARAMS_NAMED);
[$usersort] = users_order_by_sql();
$this->users = array_filter(
$DB->get_records_select('user', "id {$userselect}", $userparams, $usersort),
static function(\stdClass $user) use ($course): bool {
return user_can_view_profile($user, $course);
}
);
// Reset userids to the filtered array of users.
$this->filters->userids = implode(',', array_keys($this->users));
}
}
/**
* Setup the headers for the html table.
*/
@@ -510,20 +548,9 @@ class tablelog extends \table_sql implements \renderable {
/**
* Returns a list of selected users.
*
* @return array returns an array in the format $userid => $userid
* @return \stdClass[] List of user objects
*/
public function get_selected_users() {
global $DB;
$idlist = array();
if (!empty($this->filters->userids)) {
$idlist = explode(',', $this->filters->userids);
list($where, $params) = $DB->get_in_or_equal($idlist);
[$order] = users_order_by_sql();
return $DB->get_records_select('user', "id $where", $params, $order);
}
return $idlist;
public function get_selected_users(): array {
return $this->users;
}
}
+14 -4
View File
@@ -54,6 +54,9 @@ class report_test extends \advanced_testcase {
self::getDataGenerator()->enrol_user($u4->id, $c1->id, 'student');
self::getDataGenerator()->enrol_user($u5->id, $c1->id, 'student');
self::getDataGenerator()->enrol_user($grader1->id, $c2->id, 'teacher');
self::getDataGenerator()->enrol_user($u5->id, $c2->id, 'student');
// Modules.
$c1m1 = $this->getDataGenerator()->create_module('assign', array('course' => $c1));
$c1m2 = $this->getDataGenerator()->create_module('assign', array('course' => $c1));
@@ -126,11 +129,18 @@ class report_test extends \advanced_testcase {
$this->assertEquals(8, $this->get_tablelog_results($c1ctx, array(), true));
$this->assertEquals(13, $this->get_tablelog_results($c2ctx, array(), true));
// Filtering on 1 user.
$this->assertEquals(3, $this->get_tablelog_results($c1ctx, array('userids' => $u1->id), true));
// Filtering on 1 user the current user cannot access should return all records.
$this->assertEquals(8, $this->get_tablelog_results($c1ctx, array('userids' => $u1->id), true));
// Filtering on more users.
$this->assertEquals(4, $this->get_tablelog_results($c1ctx, array('userids' => "$u1->id,$u3->id"), true));
// Filtering on 2 users, only one of whom the current user can access.
$this->assertEquals(1, $this->get_tablelog_results($c1ctx, ['userids' => "$u1->id,$u3->id"], true));
$results = $this->get_tablelog_results($c1ctx, ['userids' => "$u1->id,$u3->id"]);
$this->assertGradeHistoryIds([$grades['c1m1u3']->id], $results);
// Filtering on 2 users, both of whom the current user can access.
$this->assertEquals(3, $this->get_tablelog_results($c1ctx, ['userids' => "$u2->id,$u3->id"], true));
$results = $this->get_tablelog_results($c1ctx, ['userids' => "$u2->id,$u3->id"]);
$this->assertGradeHistoryIds([$grades['c1m1u2']->id, $grades['c1m1u3']->id, $grades['c1m2u2']->id], $results);
// Filtering based on one grade item.
$gi = \grade_item::fetch($giparams + array('iteminstance' => $c1m1->id));
@@ -421,6 +421,8 @@ Feature: We can use calculated grade totals
| Extra credit | 0 |
| Maximum grade | 200 |
| Rescale existing grades | No |
# Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
And I change window size to "5120x2160"
And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
And I press "Save changes"
And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
@@ -432,6 +434,8 @@ Feature: We can use calculated grade totals
| Extra credit | 0 |
| Maximum grade | 100 |
| Rescale existing grades | No |
# Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
And I change window size to "5120x2160"
And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
And I press "Save changes"
And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
+19 -23
View File
@@ -114,10 +114,11 @@ Feature: We can set the grade to pass value
Scenario: Set a valid grade to pass for workshop activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| workshop | Test Workshop 1 | C1 | workshop1 |
| activity | name | intro | course | section | idnumber |
| workshop | Test Workshop 1 | Test workshop | C1 | 1 | workshop1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Workshop 1" "workshop activity editing" page
And I follow "Test Workshop 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| grade | 80 |
| Submission grade to pass | 40 |
@@ -136,16 +137,19 @@ Feature: We can set the grade to pass value
And the field "Grade to pass" matches value "10"
And I set the field "Grade to pass" to "15"
And I press "Save changes"
And I am on the "Test Workshop 1" "workshop activity editing" page
And I am on "Course 1" course homepage
And I follow "Test Workshop 1"
And I follow "Edit settings"
And the field "Submission grade to pass" matches value "45"
And the field "Assessment grade to pass" matches value "15"
Scenario: Set an invalid grade to pass for workshop activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| workshop | Test Workshop 1 | C1 | workshop1 |
| activity | name | intro | course | section | idnumber |
| workshop | Test Workshop 1 | Test workshop | C1 | 1 | workshop1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Workshop 1" "workshop activity editing" page
And I follow "Test Workshop 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| grade | 80 |
| Submission grade to pass | 90 |
@@ -179,11 +183,9 @@ Feature: We can set the grade to pass value
Scenario: Set a valid grade to pass for lesson activity
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| lesson | Test Lesson 1 | Test | C1 | 1 | lesson1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Lesson 1"
And I navigate to "Edit settings" in current page administration
| activity | name | course | idnumber |
| lesson | Test Lesson 1 | C1 | lesson1 |
And I am on the "Test Lesson 1" "lesson activity editing" page
And I set the following fields to these values:
| Grade to pass | 90 |
And I press "Save and return to course"
@@ -194,21 +196,17 @@ Feature: We can set the grade to pass value
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test Lesson 1"
And I follow "Edit settings"
And I am on the "Test Lesson 1" "lesson activity editing" page
And the field "Grade to pass" matches value "80"
Scenario: Set a valid grade to pass for lesson activity with custom decimal separator
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| lesson | Test Lesson 1 | Test | C1 | 1 | lesson1 |
| activity | name | course | idnumber |
| lesson | Test Lesson 1 | C1 | lesson1 |
And the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | # |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Lesson 1"
And I navigate to "Edit settings" in current page administration
And I am on the "Test Lesson 1" "lesson activity editing" page
And I set the following fields to these values:
| Grade to pass | 90#50 |
And I press "Save and return to course"
@@ -219,9 +217,7 @@ Feature: We can set the grade to pass value
Then the field "Grade to pass" matches value "90#50"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test Lesson 1"
And I follow "Edit settings"
And I am on the "Test Lesson 1" "lesson activity editing" page
And the field "Grade to pass" matches value "80#00"
Scenario: Set a valid grade to pass for database activity
@@ -1,8 +1,8 @@
@core @core_group
Feature: The description of a group can be viewed by students and teachers
In order to view the description of a group
Feature: The description and picture of a group can be viewed by students and teachers
In order to view the description and picture of a group
As a teacher
I need to create groups and add descriptions to them.
I need to create groups and add descriptions and picture to them.
Background:
Given the following "courses" exist:
@@ -19,11 +19,9 @@ Feature: The description of a group can be viewed by students and teachers
| student1 | C1 | student |
| student2 | C1 | student |
@javascript
Scenario: A student can see the group description when visible groups are set. Teachers can see group details.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Edit settings" in current page administration
@javascript @_file_upload
Scenario: A student can see the group description and picture when visible groups are set. Teachers can see group details.
Given I am on the "Course 1" "course editing" page logged in as "teacher1"
And I set the following fields to these values:
| Group mode | Visible groups |
And I press "Save and display"
@@ -32,6 +30,8 @@ Feature: The description of a group can be viewed by students and teachers
And I set the following fields to these values:
| Group name | Group A |
| Group description | Description for Group A |
# Upload group picture
And I upload "lib/tests/fixtures/gd-logo.png" file to "New picture" filemanager
And I press "Save changes"
And I press "Create group"
And I set the following fields to these values:
@@ -39,11 +39,12 @@ Feature: The description of a group can be viewed by students and teachers
And I press "Save changes"
And I add "Student 1 (student1@example.com)" user to "Group A" group members
And I add "Student 2 (student2@example.com)" user to "Group B" group members
And I am on "Course 1" course homepage
And I navigate to course participants
And I click on "Student 1" "link" in the "participants" "table"
And I click on "Group A" "link"
And I should see "Description for Group A"
# As teacher, confirm that group picture is displayed
And "//img[@class='grouppicture']" "xpath_element" should exist
And ".groupinfobox" "css_element" should exist
And I set the field "type" in the "Filter 1" "fieldset" to "Groups"
And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Group B"
@@ -52,27 +53,23 @@ Feature: The description of a group can be viewed by students and teachers
And I click on "Group B" "link"
And I should see "Student 2" in the "participants" "table"
And ".groupinfobox" "css_element" should not exist
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
And I navigate to course participants
And I click on "Student 1" "link" in the "participants" "table"
And I click on "Group A" "link"
# As student, confirm that group description and picture is displayed
Then I should see "Description for Group A"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And "//img[@class='grouppicture']" "xpath_element" should exist
And I am on the "Course 1" course page logged in as student2
And I navigate to course participants
And I click on "Student 2" "link" in the "participants" "table"
And I click on "Group B" "link"
And I should see "Student 2" in the "participants" "table"
And ".groupinfobox" "css_element" should not exist
@javascript
Scenario: A student can not see the group description when separate groups are set. Teachers can see group details.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Edit settings" in current page administration
@javascript @_file_upload
Scenario: A student can not see the group description and picture when separate groups are set. Teachers can see group details.
Given I am on the "Course 1" "course editing" page logged in as "teacher1"
And I set the following fields to these values:
| Group mode | Separate groups |
And I press "Save and display"
@@ -81,6 +78,8 @@ Feature: The description of a group can be viewed by students and teachers
And I set the following fields to these values:
| Group name | Group A |
| Group description | Description for Group A |
# Upload group picture
And I upload "lib/tests/fixtures/gd-logo.png" file to "New picture" filemanager
And I press "Save changes"
And I press "Create group"
And I set the following fields to these values:
@@ -88,11 +87,12 @@ Feature: The description of a group can be viewed by students and teachers
And I press "Save changes"
And I add "Student 1 (student1@example.com)" user to "Group A" group members
And I add "Student 2 (student2@example.com)" user to "Group B" group members
And I am on "Course 1" course homepage
And I navigate to course participants
And I click on "Student 1" "link" in the "participants" "table"
And I click on "Group A" "link"
And I should see "Description for Group A"
# As teacher, confirm that group picture is displayed
And "//img[@class='grouppicture']" "xpath_element" should exist
And ".groupinfobox" "css_element" should exist
And I set the field "type" in the "Filter 1" "fieldset" to "Groups"
And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Group B"
@@ -100,18 +100,16 @@ Feature: The description of a group can be viewed by students and teachers
And I click on "Student 2" "link" in the "participants" "table"
And I click on "Group B" "link"
And ".groupinfobox" "css_element" should not exist
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
And I navigate to course participants
And I click on "Student 1" "link" in the "participants" "table"
And I click on "Group A" "link"
And I should see "Student 1" in the "participants" "table"
And I should not see "Description for Group A"
# As student, confirm that group description and picture are not displayed
Then I should not see "Description for Group A"
And "//img[@class='grouppicture']" "xpath_element" should not exist
And ".groupinfobox" "css_element" should not exist
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student2
And I navigate to course participants
And I click on "Student 2" "link" in the "participants" "table"
And I click on "Group B" "link"
+7 -15
View File
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Testing the H5PFrameworkInterface interface implementation.
*
* @package core_h5p
* @category test
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_h5p;
use core_collator;
@@ -34,6 +25,7 @@ use Moodle\H5PDisplayOptionBehaviour;
* Test class covering the H5PFrameworkInterface interface implementation.
*
* @package core_h5p
* @category test
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @runTestsInSeparateProcesses
@@ -638,7 +630,7 @@ class framework_test extends \advanced_testcase {
/**
* Test the behaviour of isPatchedLibrary().
*
* @dataProvider test_isPatchedLibrary_provider
* @dataProvider isPatchedLibrary_provider
* @param array $libraryrecords Array containing data for the library creation
* @param array $testlibrary Array containing the test library data
* @param bool $expected The expectation whether the library is patched or not
@@ -660,7 +652,7 @@ class framework_test extends \advanced_testcase {
*
* @return array
*/
public function test_isPatchedLibrary_provider(): array {
public function isPatchedLibrary_provider(): array {
return [
'Unpatched library. No different versioning' => [
[
@@ -1416,7 +1408,7 @@ class framework_test extends \advanced_testcase {
/**
* Test the behaviour of loadLibrarySemantics().
*
* @dataProvider test_loadLibrarySemantics_provider
* @dataProvider loadLibrarySemantics_provider
* @param array $libraryrecords Array containing data for the library creation
* @param array $testlibrary Array containing the test library data
* @param string $expected The expected semantics value
@@ -1439,7 +1431,7 @@ class framework_test extends \advanced_testcase {
*
* @return array
*/
public function test_loadLibrarySemantics_provider(): array {
public function loadLibrarySemantics_provider(): array {
$semantics = json_encode(
[
@@ -2208,7 +2200,7 @@ class framework_test extends \advanced_testcase {
/**
* Test the behaviour of test_libraryHasUpgrade().
*
* @dataProvider test_libraryHasUpgrade_provider
* @dataProvider libraryHasUpgrade_provider
* @param array $libraryrecords Array containing data for the library creation
* @param array $testlibrary Array containing the test library data
* @param bool $expected The expectation whether the library is patched or not
@@ -2230,7 +2222,7 @@ class framework_test extends \advanced_testcase {
*
* @return array
*/
public function test_libraryHasUpgrade_provider(): array {
public function libraryHasUpgrade_provider(): array {
return [
'Lower major version; Identical lower version' => [
[
+11 -22
View File
@@ -14,23 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Test class covering the h5p data generator class.
*
* @package core_h5p
* @category test
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_h5p;
use core_h5p\local\library\autoloader;
defined('MOODLE_INTERNAL') || die();
/**
* Generator testcase for the core_grading generator.
* Test class covering the h5p data generator class.
*
* @package core_h5p
* @category test
@@ -165,7 +154,7 @@ class generator_test extends \advanced_testcase {
* Test the behaviour of generate_h5p_data(). Test whether library files are created or not
* on filesystem depending what the method defines.
*
* @dataProvider test_generate_h5p_data_files_creation_provider
* @dataProvider generate_h5p_data_files_creation_provider
* @param bool $createlibraryfiles Whether to create library files on the filesystem
* @param bool $expected The expectation whether the files have been created or not
**/
@@ -205,7 +194,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
public function test_generate_h5p_data_files_creation_provider(): array {
public function generate_h5p_data_files_creation_provider(): array {
return [
'Do not create library related files on the filesystem' => [
false,
@@ -261,7 +250,7 @@ class generator_test extends \advanced_testcase {
* Test the behaviour of create_h5p_record(). Test whather the h5p content data is
* properly saved in the database.
*
* @dataProvider test_create_h5p_record_provider
* @dataProvider create_h5p_record_provider
* @param array $h5pdata The h5p content data
* @param \stdClass $expected The expected saved data
**/
@@ -287,7 +276,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
public function test_create_h5p_record_provider(): array {
public function create_h5p_record_provider(): array {
$createdjsoncontent = json_encode(
array(
'text' => '<p>Created dummy text<\/p>\n',
@@ -384,7 +373,7 @@ class generator_test extends \advanced_testcase {
* Test the behaviour of create_contents_libraries_record(). Test whether the contents libraries
* are properly saved in the database.
*
* @dataProvider test_create_contents_libraries_record_provider
* @dataProvider create_contents_libraries_record_provider
* @param array $contentslibrariestdata The h5p contents libraries data.
* @param \stdClass $expected The expected saved data.
**/
@@ -408,7 +397,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
public function test_create_contents_libraries_record_provider(): array {
public function create_contents_libraries_record_provider(): array {
return [
'Create h5p content library with set dependency type' => [
[
@@ -444,7 +433,7 @@ class generator_test extends \advanced_testcase {
* Test the behaviour of create_library_dependency_record(). Test whether the contents libraries
* are properly saved in the database.
*
* @dataProvider test_create_library_dependency_record_provider
* @dataProvider create_library_dependency_record_provider
* @param array $librarydependencydata The library dependency data.
* @param \stdClass $expected The expected saved data.
**/
@@ -468,7 +457,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
public function test_create_library_dependency_record_provider(): array {
public function create_library_dependency_record_provider(): array {
return [
'Create h5p library dependency with set dependency type' => [
[
@@ -499,7 +488,7 @@ class generator_test extends \advanced_testcase {
/**
* Test the behaviour of create_content_file(). Test whether a file belonging to a content is created.
*
* @dataProvider test_create_content_file_provider
* @dataProvider create_content_file_provider
* @param array $filedata Data from the file to be created.
* @param array $expecteddata Data expected.Data from the file to be created.
*/
@@ -534,7 +523,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
**/
public function test_create_content_file_provider(): array {
public function create_content_file_provider(): array {
return [
'Create file in content with id 4' => [
[
+3
View File
@@ -35,3 +35,6 @@ $string['cliincorrectvalueerror'] = 'Eraro, malĝusta valoro "{$a->value}" por
$string['cliincorrectvalueretry'] = 'Malĝusta valoro, bonvolu reprovi';
$string['clitypevalue'] = 'tajpvaloro';
$string['clitypevaluedefault'] = 'tajpvaloro, tajpu Enigklavon por uzi defaŭltan valoron ({$a})';
$string['cliunknowoption'] = 'Nerekonata opcio:
{$a}
Bonvolu uzi --helpopcion.';
+1
View File
@@ -30,6 +30,7 @@
defined('MOODLE_INTERNAL') || die();
$string['language'] = 'Lingvo';
$string['moodlelogo'] = 'Moodle emblemo';
$string['next'] = 'Poste';
$string['previous'] = 'Antaŭa';
$string['reload'] = 'Reŝarĝi';
+1 -1
View File
@@ -41,4 +41,4 @@ $string['cliunknowoption'] = 'אפשרויות לא מוכרות :
אנא השתמש באפשרות העזרה.';
$string['cliyesnoprompt'] = 'רשום y (שפרושו כן) או n (שפרושו לא)';
$string['environmentrequireinstall'] = 'נדרש להתקין ולאפשר הרחבה זו';
$string['environmentrequireversion'] = 'גרסה {$a->needed} נדרשת אך הגרסה הנוכחית היא {$a->current}';
$string['environmentrequireversion'] = 'גרסה {$a->needed} נדרשת. הגרסה הנוכחית היא {$a->current}';
+3 -2
View File
@@ -39,5 +39,6 @@ $string['cliunknowoption'] = 'Танихгүй сонголтууд:
{$a}
Тусламж хэсгийг сонгоно уу.';
$string['cliyesnoprompt'] = 'y (гэвэл Тийм) n (гэвэл Үгүй)';
$string['environmentrequireinstall'] = 'суусан/идэвхжсэн байх ёстой';
$string['environmentrequireversion'] = 'та {$a->current} хувилбар ашиглаж байна {$a->needed} хувилбарыг ашиглагх ёстой';
$string['environmentrequireinstall'] = 'суулгаж идэвхжүүлсэн байх ёстой';
$string['environmentrequireversion'] = 'та {$a->current} хувилбарыг ашиглаж байгаа ба {$a->needed} хувилбарыг ашиглах ёстой';
$string['upgradekeyset'] = 'Шинэчлэх түлхүүр (тохируулах бол хоосон орхино)';
+21 -15
View File
@@ -29,18 +29,24 @@
defined('MOODLE_INTERNAL') || die();
$string['cannotcreatelangdir'] = 'lang хавтсыг үүсгэх боломжгүй.';
$string['cannotcreatetempdir'] = 'temp директор үүсгэж чадахгүй байна';
$string['cannotdownloadcomponents'] = 'Компонент татаж чадахгүй байна.';
$string['cannotdownloadzipfile'] = 'Zip файл татаж чадахгүй байна';
$string['cannotfindcomponent'] = 'Компонент олж чадахгүй байна';
$string['cannotsavemd5file'] = 'md5 файл хадгалж чадахгүй байна.';
$string['cannotsavezipfile'] = 'Zip файл хадгалж чадахгүй байна.';
$string['cannotunzipfile'] = 'Файл unzip хийж чадахгүй байна.';
$string['componentisuptodate'] = 'Компонент сүүлийн хувилбар байна.';
$string['downloadedfilecheckfailed'] = 'Татаж авсан файлыг шалгах үйл ажиллагаа бүтсэнгүй.';
$string['invalidmd5'] = 'Буруу md5';
$string['missingrequiredfield'] = 'Зарим шаардлагатай талбар орхигдсон байна.';
$string['wrongdestpath'] = 'Буруу очих зам байна. .';
$string['wrongsourcebase'] = 'Буруу хаягийн мэдээлэл байна.';
$string['wrongzipfilename'] = 'Буруу архивласан файлын нэр байна.';
$string['cannotcreatedboninstall'] = '<p>Өгөгдлийн санг үүсгэх боломжгүй.</p>
<p>Тодорхойлсон өгөгдлийн сан байхгүй, тухайн хэрэглэгч өгөгдлийн сан үүсгэх зөвшөөрөлгүй байна.</p>
<p>Сайтын администратор нь өгөгдлийн сангийн тохиргоог шалгах шаардлагатай.</p>';
$string['cannotcreatelangdir'] = 'Хэлний лавлахыг үүсгэх боломжгүй';
$string['cannotcreatetempdir'] = 'Завсрын лавлахыг үүсгэх боломжгүй';
$string['cannotdownloadcomponents'] = 'Бүрэлдэхүүн хэсгийг татаж авах боломжгүй';
$string['cannotdownloadzipfile'] = 'ZIP файлыг татаж авах боломжгүй байна';
$string['cannotfindcomponent'] = 'Бүрэлдэхүүн хэсгийг олж чадсангүй';
$string['cannotsavemd5file'] = 'md5 файлыг хадгалах боломжгүй';
$string['cannotsavezipfile'] = 'ZIP файлыг хадгалах боломжгүй';
$string['cannotunzipfile'] = 'Файлын архивыг задлах боломжгүй';
$string['componentisuptodate'] = 'Бүрэлдэхүүн хэсгийг шинэчилсэн';
$string['dmlexceptiononinstall'] = '<p>Өгөгдлийн сангийн алдаа гарлаа [{$a->errorcode}].<br />{$a->debuginfo}</p>';
$string['downloadedfilecheckfailed'] = 'Татаж авсан файлыг шалгаж чадсангүй';
$string['invalidmd5'] = 'Шалгах хувьсагч буруу байсан - дахин оролдоно уу';
$string['missingrequiredfield'] = 'Зарим шаардлагатай талбар байхгүй байна';
$string['remotedownloaderror'] = '<p>Серверт бүрэлдэхүүн хэсгийг татаж авч чадсангүй. Прокси тохиргоог шалгана уу; PHP cURL өргөтгөлийг ашиглахыг зөвлөж байна.</p>
<p>Та <a href="{$a->url}">{$a->url}</a> файлыг гараар татан авч серверийнхээ "{$a->dest}" руу хуулж, задлах шаардлагатай.</p>';
$string['wrongdestpath'] = 'Зам буруу байна';
$string['wrongsourcebase'] = 'Эх сурвалжийн URL хаягийн суурь буруу байна';
$string['wrongzipfilename'] = 'ZIP файлын нэр буруу байна';
+7 -7
View File
@@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
$string['admindirname'] = 'Pasta de administração';
$string['availablelangs'] = 'Pacotes linguísticos disponíveis';
$string['chooselanguagehead'] = 'Selecione um idioma';
$string['chooselanguagesub'] = 'Selecione o idioma a utilizar durante a instalação. Poderá depois selecionar outro(s) idioma(s) para o site e para os utilizadores.';
$string['chooselanguagesub'] = 'Selecione o idioma a utilizar durante a instalação. O idioma escolhido será definido como o predefinido mas poderá depois selecionar outro(s) idioma(s) para o site e para os utilizadores.';
$string['clialreadyconfigured'] = 'O ficheiro config.php já existe. Use \'admin/cli/install_database.php\' para instalar o Moodle para este site.';
$string['clialreadyinstalled'] = 'O ficheiro config.php já existe, use admin/cli/install_database.php para atualizar o Moodle para este site.';
$string['cliinstallheader'] = 'Programa para instalação do Moodle <b>{$a}</b> através da linha de comandos';
@@ -40,8 +40,8 @@ $string['clitablesexist'] = 'A instalação através da linha de comandos (CLI)
$string['databasehost'] = 'Servidor da base de dados';
$string['databasename'] = 'Nome da base de dados';
$string['databasetypehead'] = 'Escolha o <i>driver</i> da base de dados';
$string['dataroot'] = 'Pasta de dados';
$string['datarootpermission'] = 'Permissões da pasta de dados';
$string['dataroot'] = 'Pasta dos dados';
$string['datarootpermission'] = 'Permissões da pasta dos dados';
$string['dbprefix'] = 'Prefixo das tabelas';
$string['dirroot'] = 'Pasta do Moodle';
$string['environmenthead'] = 'A verificar sistema...';
@@ -51,18 +51,18 @@ $string['installation'] = 'Instalação';
$string['langdownloaderror'] = 'Não foi possível descarregar o idioma \'<b>{$a}</b>\' . O processo de instalação continuará em Inglês.';
$string['memorylimithelp'] = '<p>O limite de memória para o PHP definido atualmente no servidor é <b>{$a}</b>.</p><p>Um número elevado de módulos em utilização ou de utilizadores registados pode fazer com que o Moodle apresente problemas de falta de memória.</p><p>É recomendado que o PHP seja configurado com um limite de memória de pelo menos 40MB. Esta configuração pode ser definida de diversas formas:</p><ol><li>Compilação do PHP com o parâmetro <b>--enable-memory-limit</b>. Esta definição permitirá ao próprio Moodle definir o valor a utilizar.</li><li>Alteração do parâmetro <b>memory_limit</b> no ficheiro de configuração do PHP para um valor igual ou superior a 40MB.</li><li>Criação de um ficheiro <b>.htaccess</b> na raiz da pasta do Moodle com a linha <b>php_value memory_limit 40M</b><p><strong>Atenção</strong>: Em alguns servidores esta configuração impedirá o funcionamento de <b>todas</b> as páginas PHP. Nestes casos, não poderá ser utilizado o ficheiro <b>.htaccess</b>.</p></li></ol>';
$string['paths'] = 'Caminhos';
$string['pathserrcreatedataroot'] = 'O programa de instalação não conseguiu criar a pasta de dados <b>{$a->dataroot}</b>.';
$string['pathserrcreatedataroot'] = 'O programa de instalação não conseguiu criar a pasta dos dados <b>{$a->dataroot}</b>.';
$string['pathshead'] = 'Confirmar caminhos';
$string['pathsrodataroot'] = 'A pasta de dados não tem permissões de escrita.';
$string['pathsrodataroot'] = 'A pasta dos dados é só de leitura (não permite escrita).';
$string['pathsroparentdataroot'] = 'A pasta ascendente <b>{$a->parent}</b> não tem permissões de escrita. O programa de instalação não conseguiu criar a pasta <b>{$a->dataroot}</b>.';
$string['pathssubadmindir'] = 'Alguns servidores Web utilizam a pasta <strong>admin</strong> em URLs especiais de acesso a funcionalidades especiais, como é o caso de painéis de controlo. Algumas situações podem criar conflitos com a localização normal das páginas de administração do Moodle. Estes problemas podem ser resolvidos renomeando a pasta <strong>admin</strong> na instalação do Moodle e indicando aqui o novo nome a utilizar. Exemplo:<br /><br /><b>moodleadmin</b><br /><br />Esta ação resolverá os problemas de acesso das hiperligações para as funcionalidades de administração do Moodle.';
$string['pathssubdataroot'] = '<p>Pasta onde o Moodle irá armazenar todo o conteúdo de ficheiros enviados pelos utilizadores.</p>
<p>Esta pasta deve ser legível e gravável pelo utilizador do servidor web (geralmente \'www-data\', \'nobody\', ou \'apache\').</p>
<p>O utilizador do Moodle no servidor web (normalmente <b>nobody</b>, <b>apache</b> ou <b>www-data</b>) deve ter permissão de <b>leitura</b> e <b>escrita</b> nessa pasta.
<p>Não deve ser acessível diretamente através da web.</p>
<p>Se a pasta não existir, o processo de instalação tentará criá-la.</p>';
$string['pathssubdirroot'] = 'Caminho completo para a pasta que contém o código Moodle.';
$string['pathssubwwwroot'] = 'Endereço web completo de acesso ao Moodle. Não é possível aceder ao Moodle usando mais do que um endereço. Se o site tiver mais do que um endereço público, devem ser configurados redirecionamentos permanentes em todos eles, à exceção deste. Se o site pode ser acedido a partir da Internet e de Intranet, use o endereço público aqui. Se o endereço atual não está correto, altere o endereço indicado na barra de endereço do seu navegador e reinicie a instalação.';
$string['pathsunsecuredataroot'] = 'A localização da pasta de dados não é segura';
$string['pathsunsecuredataroot'] = 'A localização da pasta dos dados não é segura.';
$string['pathswrongadmindir'] = 'A pasta <b>admin</b> não existe';
$string['phpextension'] = 'Extensão <b>{$a}</b> do PHP';
$string['phpversion'] = 'Versão do PHP';
+30 -20
View File
@@ -26,39 +26,49 @@ namespace core;
*/
class geoplugin_test extends \advanced_testcase {
public function setUp(): void {
/**
* Load required test libraries
*/
public static function setUpBeforeClass(): void {
global $CFG;
require_once("$CFG->libdir/filelib.php");
require_once("$CFG->dirroot/iplookup/lib.php");
require_once("{$CFG->dirroot}/iplookup/lib.php");
}
/**
* In order to execute this test PHPUNIT_LONGTEST should be defined as true in phpunit.xml or directly in config.php
*/
public function setUp(): void {
if (!PHPUNIT_LONGTEST) {
// we do not want to DDOS their server, right?
$this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
}
$this->resetAfterTest();
$CFG->geoipfile = '';
}
public function test_ipv4() {
/**
* Test IPv4 address
*
* @covers ::iplookup_find_location
*/
public function test_ipv4(): void {
$result = iplookup_find_location('50.0.184.0');
$this->assertEquals('array', gettype($result));
$this->assertEquals('San Francisco', $result['city']);
$this->assertEqualsWithDelta(-122.3933, $result['longitude'], 0.1, 'Coordinates are out of accepted tolerance');
$this->assertEqualsWithDelta(37.7697, $result['latitude'], 0.1, 'Coordinates are out of accepted tolerance');
$this->assertIsArray($result);
$this->assertIsFloat($result['latitude']);
$this->assertIsFloat($result['longitude']);
$this->assertIsString($result['city']);
$this->assertIsString($result['country']);
$this->assertIsArray($result['title']);
$this->assertIsString($result['title'][0]);
$this->assertIsString($result['title'][1]);
$this->assertNull($result['error']);
$this->assertEquals('array', gettype($result['title']));
$this->assertEquals('San Francisco', $result['title'][0]);
$this->assertEquals('United States', $result['title'][1]);
}
public function test_geoip_ipv6() {
/**
* Test IPv6 address (unsupported by Geoplugin)
*
* @covers ::iplookup_find_location
*/
public function test_ipv6(): void {
$result = iplookup_find_location('2a01:8900:2:3:8c6c:c0db:3d33:9ce6');
$this->assertNotNull($result['error']);
$this->assertEquals($result['error'], get_string('invalidipformat', 'error'));
}
}
+1
View File
@@ -1233,6 +1233,7 @@ $string['sitepolicyhandlerplugin'] = '{$a->name} ({$a->component})';
$string['sitepolicyguest'] = 'Site policy URL for guests';
$string['sitepolicyguest_help'] = 'The URL of the site policy that all guests must see and agree to before accessing the site. Note that this setting will only have an effect if the site policy handler is set to default (core).';
$string['sitesectionhelp'] = 'If selected, a topic section will be displayed on the site\'s front page.';
$string['sixtyfourbitsrequired'] = 'It has been detected that your site is not using a 64-bit PHP version. You are required to upgrade your system (operating system, PHP...) before installing this Moodle version.';
$string['sixtyfourbitswarning'] = 'It has been detected that your site is not using a 64-bit PHP version. It is recommended that you upgrade your site to ensure future compatibility.';
$string['slasharguments'] = 'Use slash arguments';
$string['slashargumentswarning'] = 'It is recommended that the use of slash arguments is enabled. In future it will be required. For more details, see the documentation <a href="https://docs.moodle.org/en/admin/environment/slasharguments">Using slash arguments</a>.';
+1 -1
View File
@@ -137,7 +137,7 @@ function behat_error_handler($errno, $errstr, $errfile, $errline) {
// set to DEVELOPER and will always include E_NOTICE,E_USER_NOTICE... as part of E_ALL, if the current
// error_reporting() value does not include one of those levels is because it has been forced through
// the moodle code (see fix_utf8() for example) in that cases we respect the forced error level value.
$respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING);
$respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED);
foreach ($respect as $respectable) {
// If the current value does not include this kind of errors and the reported error is
@@ -68,7 +68,6 @@ class mustache_pix_helper {
if (!$component) {
$component = '';
}
$component = $helper->render($component);
$text = strtok("");
// Allow mustache tags in the last argument.
$text = trim($helper->render($text));
+4 -4
View File
@@ -2266,7 +2266,7 @@ class ddl_test extends \database_driver_testcase {
*
* @return array The type-value pair fixture.
*/
public function test_get_enc_quoted_provider() {
public function get_enc_quoted_provider() {
return array(
// Reserved: some examples from SQL-92.
[true, 'from'],
@@ -2280,7 +2280,7 @@ class ddl_test extends \database_driver_testcase {
/**
* This is a test for sql_generator::getEncQuoted().
*
* @dataProvider test_get_enc_quoted_provider
* @dataProvider get_enc_quoted_provider
* @param bool $reserved Whether the column name is reserved or not.
* @param string $columnname The column name to be quoted, according to the value of $reserved.
**/
@@ -2315,7 +2315,7 @@ class ddl_test extends \database_driver_testcase {
*
* @return array The type-old-new tuple fixture.
*/
public function test_sql_generator_get_rename_field_sql_provider() {
public function sql_generator_get_rename_field_sql_provider() {
return array(
// Reserved: an example from SQL-92.
// Both names should be reserved.
@@ -2328,7 +2328,7 @@ class ddl_test extends \database_driver_testcase {
/**
* This is a unit test for sql_generator::getRenameFieldSQL().
*
* @dataProvider test_sql_generator_get_rename_field_sql_provider
* @dataProvider sql_generator_get_rename_field_sql_provider
* @param bool $reserved Whether the column name is reserved or not.
* @param string $oldcolumnname The column name to be renamed.
* @param string $newcolumnname The new column name.
+11 -6
View File
@@ -54,14 +54,19 @@ class MoodleQuickForm_password extends HTML_QuickForm_password implements templa
*/
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
global $CFG;
// no standard mform in moodle should allow autocomplete of passwords
// No standard mform in moodle should allow autocomplete of passwords.
if (empty($attributes)) {
$attributes = array('autocomplete'=>'off');
} else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off';
} else {
$attributes = ['autocomplete' => 'new-password'];
} else if (is_array($attributes) && empty($attributes['autocomplete'])) {
$attributes['autocomplete'] = 'new-password';
} else if (is_array($attributes) && $attributes['autocomplete'] === 'off') {
// A value of 'off' is ignored in all modern browsers and password
// managers and should be new-password instead.
$attributes['autocomplete'] = 'new-password';
} else if (is_string($attributes)) {
if (strpos($attributes, 'autocomplete') === false) {
$attributes .= ' autocomplete="off" ';
$attributes .= ' autocomplete="new-password" ';
}
}
-10
View File
@@ -52,16 +52,6 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
* or an associative array
*/
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
// no standard mform in moodle should allow autocomplete of passwords
if (empty($attributes)) {
$attributes = array('autocomplete'=>'off');
} else if (is_array($attributes)) {
$attributes['autocomplete'] = 'off';
} else {
if (strpos($attributes, 'autocomplete') === false) {
$attributes .= ' autocomplete="off" ';
}
}
$this->_persistantFreeze = true;
parent::__construct($elementName, $elementLabel, $attributes);
@@ -59,7 +59,7 @@
{{# error }}
autofocus aria-describedby="{{ element.iderror }}"
{{/ error }}
{{{ attributes }}}
{{{ element.attributes }}}
>
</span>
{{^ element.frozen }}
@@ -20,7 +20,6 @@ Feature: Using the lesson activities which support point scale
| course | C1 |
| activity | lesson |
| name | Test lesson name |
| intro | Test forum description |
| idnumber | lesson1 |
@javascript
@@ -37,11 +36,9 @@ Feature: Using the lesson activities which support point scale
| id_enableotheranswers | 1 |
| id_jumpto_6 | Next page |
And I press "Save page"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I set the field "Your answer" to "5"
And I press "Submit"
And I log out
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
And I expand all fieldsets
Then the "Maximum grade" "field" should be disabled
+4 -9
View File
@@ -734,8 +734,6 @@ class behat_navigation extends behat_base {
* @throws Exception with a meaningful error message if the specified page cannot be found.
*/
protected function resolve_core_page_instance_url(string $type, string $identifier): moodle_url {
global $DB;
$type = strtolower($type);
switch ($type) {
@@ -819,9 +817,8 @@ class behat_navigation extends behat_base {
* @return void
*/
public function i_am_on_course_homepage($coursefullname) {
global $DB;
$course = $DB->get_record("course", array("fullname" => $coursefullname), 'id', MUST_EXIST);
$url = new moodle_url('/course/view.php', ['id' => $course->id]);
$courseid = $this->get_course_id($coursefullname);
$url = new moodle_url('/course/view.php', ['id' => $courseid]);
$this->execute('behat_general::i_visit', [$url]);
}
@@ -834,10 +831,8 @@ class behat_navigation extends behat_base {
* @return void
*/
public function i_am_on_course_homepage_with_editing_mode_on($coursefullname) {
global $DB;
$course = $DB->get_record("course", array("fullname" => $coursefullname), 'id', MUST_EXIST);
$url = new moodle_url('/course/view.php', ['id' => $course->id]);
$courseid = $this->get_course_id($coursefullname);
$url = new moodle_url('/course/view.php', ['id' => $courseid]);
if ($this->running_javascript() && $sesskey = $this->get_sesskey()) {
// Javascript is running so it is possible to grab the session ket and jump straight to editing mode.
+18 -1
View File
@@ -166,7 +166,18 @@ class core_date_testcase extends advanced_testcase {
}
}
public function test_timezone_lang_strings() {
/**
* We are only checking lang strings existence here, not code.
*
* @coversNothing
*/
public function test_timezone_all_lang_strings() {
// We only run this test when PHPUNIT_LONGTEST is enabled, test_get_localised_timezone()
// is already checking the names of a few, hopefully stable enough to be run always.
if (!PHPUNIT_LONGTEST) {
$this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
}
$phpzones = DateTimeZone::listIdentifiers();
$manager = get_string_manager();
foreach ($phpzones as $tz) {
@@ -183,6 +194,12 @@ class core_date_testcase extends advanced_testcase {
$result = core_date::get_localised_timezone('Pacific/Auckland');
$this->assertSame('Pacific/Auckland', $result);
$result = core_date::get_localised_timezone('Europe/Madrid');
$this->assertSame('Europe/Madrid', $result);
$result = core_date::get_localised_timezone('America/New_York');
$this->assertSame('America/New_York', $result);
$result = core_date::get_localised_timezone('99');
$this->assertSame('Server timezone (Pacific/Auckland)', $result);
@@ -22,8 +22,10 @@ namespace core\output;
* @package core
* @copyright 2019 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \core\output\mustache_helper_collection
*/
class mustache_helper_collection_test extends \advanced_testcase {
/**
* Test cases to confirm that disallowed helpers are stripped from the source
* text by the helper before being passed to other another helper. This prevents
@@ -66,7 +68,7 @@ class mustache_helper_collection_test extends \advanced_testcase {
'input' => 'core, {{#js}} some nasty JS {{/js}}, test',
'expected' => 'core, {{}}, test'
],
'single disallowed 3' => [
'single disallowed 4' => [
'disallowed' => ['js'],
'input' => 'core, {{#ok}} this is ok {{/ok}}, {{#js}} some nasty JS {{/js}}',
'expected' => 'core, {{#ok}} this is ok {{/ok}}, {{}}'
@@ -111,7 +113,7 @@ class mustache_helper_collection_test extends \advanced_testcase {
'input' => '{{#foo}} blah {{/foo}}, {{#js}} js {{/js}}, {{#foo}} blah {{/foo}}',
'expected' => '{{}}'
],
'multiple disallowed 4' => [
'multiple disallowed 5' => [
'disallowed' => ['js', 'foo'],
'input' => 'core, move, {{#js}} JS {{#foo}} blah {{/foo}} {{/js}}',
'expected' => 'core, move, {{}}'
@@ -134,7 +134,7 @@ TBC;
/**
* Data provider for the test_load function.
*/
public function test_load_test_cases() {
public function load_test_cases() {
$cache = [
'core' => [
'test' => '{{! a comment }}The rest of the template'
@@ -163,7 +163,7 @@ TBC;
/**
* Test the load function.
*
* @dataProvider test_load_test_cases()
* @dataProvider load_test_cases
* @param mustache_template_source_loader $loader The loader
* @param string $component The moodle component
* @param string $name The template name
@@ -177,7 +177,7 @@ TBC;
/**
* Data provider for the load_with_dependencies function.
*/
public function test_load_with_dependencies_test_cases() {
public function load_with_dependencies_test_cases() {
// Create a bunch of templates that include one another in various ways. There is
// multiple instances of recursive inclusions to test that the code doensn't get
// stuck in an infinite loop.
@@ -330,7 +330,7 @@ TBC;
/**
* Test the load_with_dependencies function.
*
* @dataProvider test_load_with_dependencies_test_cases()
* @dataProvider load_with_dependencies_test_cases
* @param mustache_template_source_loader $loader The loader
* @param string $component The moodle component
* @param string $name The template name
@@ -344,7 +344,7 @@ TBC;
/**
* Data provider for the test_load function.
*/
public function test_scan_template_source_for_dependencies_test_cases() {
public function scan_template_source_for_dependencies_test_cases() {
$foo = '{{! a comment }}{{> core/bar }}{{< test/bop }}{{/ test/bop}}{{#str}} help, core {{/str}}';
$bar = '{{! a comment }}{{> core/baz }}';
$baz = '{{! a comment }}{{#str}} hide, core {{/str}}';
@@ -488,7 +488,7 @@ TEMPLATE;
/**
* Test the scan_template_source_for_dependencies function.
*
* @dataProvider test_scan_template_source_for_dependencies_test_cases()
* @dataProvider scan_template_source_for_dependencies_test_cases()
* @param mustache_template_source_loader $loader The loader
* @param string $source The template to test
* @param string $expected The expected output
+9 -16
View File
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types = 1);
namespace core\plugininfo;
use testable_core_plugin_manager;
use testable_plugininfo_base;
/**
* Unit tests for plugin base class.
*
@@ -21,20 +28,6 @@
* @copyright 2019 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
declare(strict_types = 1);
namespace core\plugininfo;
defined('MOODLE_INTERNAL') || die();
use core_plugin_manager;
use testable_core_plugin_manager;
use testable_plugininfo_base;
/**
* Tests of the basic API of the plugin manager.
*/
class base_test extends \advanced_testcase {
/**
@@ -172,7 +165,7 @@ class base_test extends \advanced_testcase {
* Test the load_disk_version function to check that it handles a range of correct supported and incompatible field
* definitions.
*
* @dataProvider test_load_disk_version_branch_supports_provider
* @dataProvider load_disk_version_branch_supports_provider
* @param array|null $supported Supported versions to inject
* @param string|int|null $incompatible Incompatible version to inject.
* @param int $version Version to test
@@ -204,7 +197,7 @@ class base_test extends \advanced_testcase {
*
* @return array
*/
public function test_load_disk_version_branch_supports_provider(): array {
public function load_disk_version_branch_supports_provider(): array {
return [
'Range, branch in support, lowest' => [
'supported' => [29, 31],
+2 -2
View File
@@ -29,7 +29,7 @@ require_once(__DIR__ . '/../fixtures/task_fixtures.php');
*/
class manager_test extends \advanced_testcase {
public function test_ensure_adhoc_task_qos_provider() {
public function ensure_adhoc_task_qos_provider() {
return [
[
[],
@@ -173,7 +173,7 @@ class manager_test extends \advanced_testcase {
/**
* Test that the Quality of Service reordering works.
*
* @dataProvider test_ensure_adhoc_task_qos_provider
* @dataProvider ensure_adhoc_task_qos_provider
*
* @param array $input array of tasks
* @param array $expected array of reordered tasks
@@ -34,10 +34,10 @@ Feature: Embed videos without the media filter
@javascript
Scenario: Add a video as content to a lesson. Make sure media filters work
When I add a "Lesson" to section "1"
And I set the following fields to these values:
| Name | Lesson with video |
| Description | Example of a video in a lesson |
Given the following "activities" exist:
| activity | course | section | name |
| lesson | Acceptance test site | 1 | Lesson with video |
When I am on the "Lesson with video" "lesson activity editing" page
And I expand all fieldsets
And I upload "media/player/videojs/tests/fixtures/test.mov" file to "Linked media" filemanager
And I press "Save and display"
@@ -46,7 +46,6 @@ class manager_test extends \advanced_testcase {
$this->assertEquals(\core\check\result::OK, $checks[3]->get_status()); // Airnotifier URL available.
$this->assertEquals(\core\check\result::ERROR, $checks[4]->get_status()); // Missing access key.
$this->assertEquals(\core\check\result::WARNING, $checks[5]->get_status()); // Only a few of default mobile notifications.
$this->assertEquals(\core\check\result::ERROR, $checks[6]->get_status()); // No registered devices yet.
}
/** Test check_configuration with token **/
@@ -69,7 +68,6 @@ class manager_test extends \advanced_testcase {
$this->assertEquals(\core\check\result::OK, $checks[3]->get_status()); // Airnotifier URL available.
// The original function fourth check (access key valid in the remote Airnotifier server) is not mockable.
$this->assertEquals(\core\check\result::WARNING, $checks[4]->get_status()); // Only a few of default mobile notifications.
$this->assertEquals(\core\check\result::ERROR, $checks[5]->get_status()); // No registered devices yet.
}
/** Test check_configuration bad settings **/
@@ -94,7 +92,6 @@ class manager_test extends \advanced_testcase {
$this->assertEquals(\core\check\result::OK, $checks[4]->get_status()); // Invalid setting (empty space).
// The original function fifth check (access key valid in the remote Airnotifier server) is not mockable.
$this->assertEquals(\core\check\result::WARNING, $checks[5]->get_status()); // Only a few of default mobile notifications.
$this->assertEquals(\core\check\result::ERROR, $checks[6]->get_status()); // No registered devices yet.
}
/** Test has_enabled_devices **/
+3 -3
View File
@@ -5776,7 +5776,7 @@ class api_test extends messagelib_test {
/**
* Data provider for test_get_conversation_counts().
*/
public function test_get_conversation_counts_test_cases() {
public function get_conversation_counts_test_cases() {
$typeindividual = api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL;
$typegroup = api::MESSAGE_CONVERSATION_TYPE_GROUP;
$typeself = api::MESSAGE_CONVERSATION_TYPE_SELF;
@@ -6139,7 +6139,7 @@ class api_test extends messagelib_test {
/**
* Test the get_conversation_counts() function.
*
* @dataProvider test_get_conversation_counts_test_cases()
* @dataProvider get_conversation_counts_test_cases
* @param array $conversationconfigs Conversations to create
* @param int $deletemessagesuser The user who is deleting the messages
* @param array $deletemessages The list of messages to delete (by index)
@@ -6262,7 +6262,7 @@ class api_test extends messagelib_test {
/**
* Test the get_unread_conversation_counts() function.
*
* @dataProvider test_get_conversation_counts_test_cases()
* @dataProvider get_conversation_counts_test_cases
* @param array $conversationconfigs Conversations to create
* @param int $deletemessagesuser The user who is deleting the messages
* @param array $deletemessages The list of messages to delete (by index)
+3 -3
View File
@@ -5136,7 +5136,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Data provider for test_get_conversation_counts().
*/
public function test_get_conversation_counts_test_cases() {
public function get_conversation_counts_test_cases() {
$typeindividual = \core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL;
$typegroup = \core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP;
$typeself = \core_message\api::MESSAGE_CONVERSATION_TYPE_SELF;
@@ -5499,7 +5499,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Test the get_conversation_counts() function.
*
* @dataProvider test_get_conversation_counts_test_cases()
* @dataProvider get_conversation_counts_test_cases()
* @param array $conversationconfigs Conversations to create
* @param int $deletemessagesuser The user who is deleting the messages
* @param array $deletemessages The list of messages to delete (by index)
@@ -5596,7 +5596,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Test the get_unread_conversation_counts() function.
*
* @dataProvider test_get_conversation_counts_test_cases()
* @dataProvider get_conversation_counts_test_cases
* @param array $conversationconfigs Conversations to create
* @param int $deletemessagesuser The user who is deleting the messages
* @param array $deletemessages The list of messages to delete (by index)
@@ -317,3 +317,73 @@ Feature: Group assignment submissions
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
@javascript @_file_upload
Scenario: Student can submit or edit group assignment depending on 'requireallteammemberssubmit' setting
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 2 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry | Alexander | teacher1@example.com |
| student1 | Sam | Edwards | student1@example.com |
| student2 | Carlos | Rivera | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G1 |
And the following "activities" exist:
| activity | course | name | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | submissiondrafts | teamsubmission | requireallteammemberssubmit |
| assign | C1 | Assign 1 | 1 | 1 | 1 | 2097152 | 1 | 1 | 1 |
| assign | C1 | Assign 2 | 1 | 1 | 1 | 2097152 | 0 | 1 | 0 |
# Submit an assignment with 'requireallteammemberssubmit' setting enabled
When I am on the "Assign 1" "assign activity" page logged in as student1
Then I should see "Group 1"
And I should not see "Carlos Rivera"
And I press "Add submission"
And I set the field "Online text" to "student1 submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"
# Confirm that Submission status remains as draft and all students appear because 'Submit assignment' was not yet clicked
And I should see "Draft (not submitted)" in the "Submission status" "table_row"
And I should see "Users who need to submit: Sam Edwards, Carlos Rivera"
And I press "Submit assignment"
And I press "Continue"
# Confirm that Submission status remains as draft and only student2 appears because student2 has not yet submitted assignment
And I am on the "Assign 1" "assign activity" page logged in as student2
And I should see "Draft (not submitted)" in the "Submission status" "table_row"
And I should see "Users who need to submit: Carlos Rivera"
And I press "Edit submission"
And I set the field "Online text" to "student2 updated submission"
And I delete "empty.txt" from "File submissions" filemanager
And I upload "lib/tests/fixtures/tabfile.csv" file to "File submissions" filemanager
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
# Confirm that Submission status is now Submitted for grading and all changes made by student2 is reflected on assignment
And I am on the "Assign 1" "assign activity" page logged in as student1
And I should see "Submitted for grading" in the "Submission status" "table_row"
And I should see "student2 updated submission" in the "Online text" "table_row"
And I should see "tabfile.csv" in the "File submissions" "table_row"
And I should not see "student1 submission" in the "Online text" "table_row"
And I should not see "empty.txt" in the "File submissions" "table_row"
# Submit an assignment with 'requireallteammemberssubmit' disabled
And I am on the "Assign 2" "assign activity" page logged in as student1
And I should see "Group 1"
And I should not see "Carlos Rivera"
And I press "Add submission"
And I set the field "Online text" to "student1 submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"
# Confirm that Submission status is immediately set to Submitted for grading for all students after student1 submits assignments
And I am on the "Assign 2" "assign activity" page logged in as student2
And I should see "Submitted for grading" in the "Submission status" "table_row"
And I should not see "Users who need to submit"
@@ -0,0 +1,47 @@
@mod @mod_assign @javascript
Feature: Manage assignment submission web notifications
In order to receive assignment submission notifications
As a teacher
I need to be able to turn on web notifications for assignment submission
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Assign 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
| sendnotifications | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Assign 1 | student1 | I'm the student1 submission |
Scenario: Teacher can choose to receive assignment notification submissions
Given I log in as "teacher1"
When I open the notification popover
Then I should see "You have no notifications"
# Update assignment submission to generate a notification
And I am on the "Assign 1" "assign activity" page logged in as student1
And the following "user preferences" exist:
| user | preference | value |
| teacher1 | message_provider_mod_assign_assign_notification_loggedin | popup |
# This should generate a notification
And I press "Edit submission"
And I set the field "Online text" to "updated"
And I press "Save changes"
# Confirm that teacher received assignment submission notification
And I log in as "teacher1"
And I open the notification popover
Then I should see "Student 1 has updated their submission for assignment Assign 1"
@@ -0,0 +1,55 @@
@mod @mod_assign
Feature: In an assignment, teacher can require submission statements
In order to require students to accept an assignment submission statement
As a teacher
I need to enable "Require that students accept the submission statement"
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry | Teacher | teacher1@example.com |
| student1 | Sam | Student | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assign |
| submissiondrafts | 1 |
| requiresubmissionstatement | 1 |
| assignsubmission_onlinetext_enabled | 1 |
Scenario: Student is required to accept assignment submission statement
Given I am on the "Test assign" "assign activity" page logged in as student1
And I press "Add submission"
And I set the field "Online text" to "My submission text."
And I press "Save changes"
And I should see "Draft (not submitted)" in the "Submission status" "table_row"
When I press "Submit assignment"
Then I should see "This submission is my own work, except where I have acknowledged the use of the works of other people."
And I press "Continue"
And I should see "Confirm submission"
And I should see "- Required"
And I set the field "submissionstatement" to "1"
And I press "Continue"
And I should see "Submitted for grading" in the "Submission status" "table_row"
Scenario: Student is not required to accept assignment submission statement
Given I am on the "Test assign" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| Require that students accept the submission statement | No |
And I press "Save and display"
And I am on the "Test assign" "assign activity" page logged in as student1
And I press "Add submission"
And I set the field "Online text" to "My submission text."
And I press "Save changes"
And I should see "Draft (not submitted)" in the "Submission status" "table_row"
When I press "Submit assignment"
Then I should not see "This submission is my own work, except where I have acknowledged the use of the works of other people."
And I press "Continue"
And I should see "Submitted for grading" in the "Submission status" "table_row"
+2 -2
View File
@@ -875,7 +875,7 @@ class locallib_test extends \advanced_testcase {
* We only test combinations of plugins here. Individual plugins are tested
* in their respective test files.
*
* @dataProvider test_new_submission_empty_testcases
* @dataProvider new_submission_empty_testcases
* @param string $data The file submission data
* @param bool $expected The expected return value
*/
@@ -915,7 +915,7 @@ class locallib_test extends \advanced_testcase {
*
* @return array of testcases
*/
public function test_new_submission_empty_testcases() {
public function new_submission_empty_testcases() {
return [
'With file and onlinetext' => [
[
@@ -21,7 +21,6 @@ Feature: View activity completion information in the book activity
| course | C1 |
| idnumber | mh1 |
| name | Music history |
| section | 1 |
| completion | 2 |
| completionview | 1 |
@@ -32,7 +31,6 @@ Feature: View activity completion information in the book activity
| content | Rudiments are important |
And I am on the "Music history" "book activity" page logged in as teacher1
And "Music history" should have the "View" completion condition
And I log out
# Student view.
When I am on the "Music history" "book activity" page logged in as student1
Then the "View" completion condition of "Music history" is displayed as "done"
@@ -50,7 +48,6 @@ Feature: View activity completion information in the book activity
And I am on the "Music history" "book activity" page
# Teacher view.
And the manual completion button for "Music history" should be disabled
And I log out
# Student view.
Given I am on the "Music history" "book activity" page logged in as student1
Then the manual completion button of "Music history" is displayed as "Mark as done"
+8 -14
View File
@@ -15,18 +15,17 @@ Feature: In a book, create chapters and sub chapters
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| book | Test book | A book about dreams! | C1 | book1 | 1 |
| activity | name | course | idnumber | section |
| book | Test book | C1 | book1 | 1 |
And the following "mod_book > chapter" exists:
| book | Test book |
| title | Dummy first chapter |
| content | Dream is the start of a journey |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Create chapters and sub chapters and navigate between them
Given I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
And I press "Save changes"
Given I am on the "Test book" "book activity" page
And I should see "1. Dummy first chapter" in the "Table of contents" "block"
And I click on "Add new chapter after \"Dummy first chapter\"" "link" in the "Table of contents" "block"
And I should see "Dummy first chapter"
@@ -62,12 +61,7 @@ Feature: In a book, create chapters and sub chapters
And I should see "1. Dummy first chapter" in the "strong" "css_element"
Scenario: Change editing mode for an individual chapter
Given I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
And I press "Save changes"
Given I am on the "Test book" "book activity" page
And I should see "1. Dummy first chapter" in the "Table of contents" "block"
And "Edit chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block"
And "Delete chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block"
@@ -15,26 +15,19 @@ Feature: Display the book description in the book and optionally in the course
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| book | Test book | A book about dreams! | C1 | book1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
And I press "Save changes"
| activity | name | intro | course | idnumber |
| book | Test book | A book about dreams! | C1 | book1 |
And the following "mod_book > chapter" exists:
| book | Test book |
| title | Dummy first chapter |
| content | Dream is the start of a journey |
Scenario: Description is displayed in the book
Given I am on "Course 1" course homepage
When I follow "Test book"
When I am on the "Test book" "book activity" page logged in as teacher1
Then I should see "A book about dreams!"
Scenario: Show book description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test book"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test book" "book activity editing" page logged in as teacher1
And the following fields match these values:
| Display description on course page | |
And I set the following fields to these values:
@@ -44,9 +37,7 @@ Feature: Display the book description in the book and optionally in the course
Then I should see "A book about dreams!"
Scenario: Hide book description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test book"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test book" "book activity editing" page logged in as teacher1
And the following fields match these values:
| Display description on course page | |
And I press "Save and return to course"
@@ -18,16 +18,14 @@ Feature: In a book, change the navigation options
Scenario: Change navigation options
Given the following "activities" exist:
| activity | name | intro | course | idnumber | section | navstyle |
| book | Test book | A book about lorem ipsum | C1 | book1 | 1 | 0 |
| activity | name | course | idnumber | navstyle |
| book | Test book | C1 | book1 | 0 |
And the following "mod_book > chapter" exists:
| book | Test book |
| title | Test chapter 1 |
| content | Lorem ipsum dolor sit amet |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
| Chapter title | Test chapter 1 |
| Content | Lorem ipsum dolor sit amet |
And I press "Save changes"
And I should see "Test book"
And I should see "1. Test chapter 1"
And I click on "Add new chapter" "link" in the "Table of contents" "block"
And I set the following fields to these values:
-2
View File
@@ -17,7 +17,6 @@ Feature: Edited book chapters handle tags correctly
| course | C1 |
| idnumber | book1 |
| name | Test book |
| description | A book about dreams |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@@ -47,7 +46,6 @@ Feature: Edited book chapters handle tags correctly
And I follow "Add standard tags"
And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3"
And I press "Continue"
And I log out
And I am on the "Test book" "book activity" page logged in as teacher1
And I open the autocomplete suggestions list
And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element"
+1 -1
View File
@@ -13,7 +13,7 @@ Feature: In a book, verify log entries
| course | C1 |
| activity | book |
| name | Test book |
And I am on the "Course 1" course page logged in as admin
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test book" "book activity" page
And I set the following fields to these values:
@@ -15,39 +15,18 @@ Feature: In a book, chapters and subchapters can be rearranged
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| book | Test book | A book about rearrangements! | C1 | book1 | 1 |
| activity | name | course | idnumber |
| book | Test book | C1 | book1 |
And the following "mod_book > chapters" exist:
| book | title | content | pagenum |subchapter |
| Test book | Originally first chapter | #1 chapter content | 1 | 0 |
| Test book | A great second chapter | #2 chapter content | 2 | 0 |
| Test book | Second chapter, subchapter 1 | #21 subchapter content | 3 | 1 |
| Test book | Second chapter, subchapter 2 | #22 subchapter content | 4 | 1 |
| Test book | There aren't 2 without 3 | #3 subchapter content | 5 | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
| Chapter title | Originally first chapter |
| Content | #1 chapter content |
And I press "Save changes"
And I click on "Add new chapter after \"Originally first chapter\"" "link"
And I set the following fields to these values:
| Chapter title | A great second chapter |
| Content | #2 chapter content |
And I press "Save changes"
And I click on "Add new chapter after \"A great second chapter\"" "link"
And I set the following fields to these values:
| Chapter title | Second chapter, subchapter 1 |
| Content | #21 subchapter content |
| Subchapter | 1 |
And I press "Save changes"
And I click on "Add new chapter after \"Second chapter, subchapter 1\"" "link"
And I set the following fields to these values:
| Chapter title | Second chapter, subchapter 2 |
| Content | #22 subchapter content |
| Subchapter | 1 |
And I press "Save changes"
And I click on "Add new chapter after \"Second chapter, subchapter 2\"" "link"
And I set the following fields to these values:
| Chapter title | There aren't 2 without 3 |
| Content | #3 subchapter content |
| Subchapter | 0 |
And I press "Save changes"
Scenario: Moving chapters down rearranges them properly
Given I click on "Move chapter down \"1. Originally first chapter\"" "link"
+10 -28
View File
@@ -20,34 +20,17 @@ Feature: Book activity chapter visibility management
| course | C1 |
| activity | book |
| name | Test book |
And I am on the "Test book" "book activity" page logged in as teacher1
And I set the following fields to these values:
| Chapter title | First chapter |
| Content | First chapter |
And I press "Save changes"
And the following "mod_book > chapters" exist:
| book | title | content | pagenum |subchapter |
| Test book | First chapter | First chapter | 1 | 0 |
| Test book | Second chapter | Second chapter | 2 | 0 |
| Test book | Sub chapter | Sub chapter | 3 | 1 |
| Test book | Third chapter | Third chapter | 4 | 0 |
| Test book | Fourth chapter | Fourth chapter | 5 | 0 |
And I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I click on "Add new chapter after \"First chapter\"" "link"
And I set the following fields to these values:
| Chapter title | Second chapter |
| Content | Second chapter |
And I press "Save changes"
And I click on "Add new chapter after \"Second chapter\"" "link"
And I set the following fields to these values:
| Chapter title | Sub chapter |
| subchapter | 1 |
| Content | Sub chapter |
And I press "Save changes"
And I click on "Add new chapter after \"Sub chapter\"" "link"
And I set the following fields to these values:
| Chapter title | Third chapter |
| subchapter | 0 |
| Content | Third chapter |
And I press "Save changes"
And I click on "Add new chapter after \"Third chapter\"" "link"
And I set the following fields to these values:
| Chapter title | Fourth chapter |
| Content | Fourth chapter |
And I press "Save changes"
And I am on the "Test book" "book activity" page
And I click on "4. Fourth chapter" "link" in the "Table of contents" "block"
@javascript
Scenario: Show/hide chapters and subchapters
@@ -68,7 +51,6 @@ Feature: Book activity chapter visibility management
And I follow "Next"
And I should see "Fourth chapter" in the ".book_content" "css_element"
And I follow "Exit book"
And I log out
And I am on the "Test book" "book activity" page logged in as student1
And I should not see "Second chapter" in the "Table of contents" "block"
And I should not see "Third chapter" in the "Table of contents" "block"
@@ -0,0 +1,48 @@
@mod @mod_resource @_file_upload
Feature: Details of uploaded file in the resource can be changed
In order to change details of an uploaded file in a folder resource
As a teacher
I should be able to upload a file
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | t1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | name |
| folder | C1 | Folder1 |
@javascript
Scenario: Uploaded file details can be changed
Given I am on the "Folder1" "folder activity" page logged in as teacher1
And I click on "Edit" "button"
# Upload a file in folder resource
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
And I click on "Edit" "button"
And I click on "empty.txt" "link"
# Initially, file details are set to default values
And the following fields match these values:
| Name | empty.txt |
| Author | Teacher 1 |
| licence | Licence not specified |
# Update the file details for testing
When I set the following fields to these values:
| Name | empty_file.txt |
| Author | Teacher 1 |
| licence | All rights reserved |
And I press "Update"
And I press "Save changes"
# Confirm that file details have been updated correctly
And I click on "Edit" "button"
And I click on "empty_file.txt" "link"
Then the following fields match these values:
| Name | empty_file.txt |
| Author | Teacher 1 |
| licence | All rights reserved |
+1 -1
View File
@@ -5,6 +5,6 @@
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("mod_forum/discussion_list",["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository","core/pubsub","mod_forum/forum_events"],(function($,Templates,Str,Notification,SubscriptionToggle,Selectors,Repository,PubSub,ForumEvents){return{init:function(root){SubscriptionToggle.init(root,!1,(function(toggleElement,context){var toggleId=toggleElement.attr("id"),newTargetState=context.userstate.subscribed?0:1;toggleElement.data("targetstate",newTargetState);var stringKey=context.userstate.subscribed?"unsubscribediscussion":"subscribediscussion";return Str.get_string(stringKey,"mod_forum").then((function(string){return toggleElement.closest("td").find('label[for="'+toggleId+'"]').find("span").text(string),string}))})),function(root){PubSub.subscribe(ForumEvents.SUBSCRIPTION_TOGGLED,(function(data){var discussionId=data.discussionId,subscribed=data.subscriptionState,discussionListItem=root.find(Selectors.discussion.item+"[data-discussionid= "+discussionId+"]"),subscribedLabel=discussionListItem.find(Selectors.discussion.subscribedLabel);subscribed?(discussionListItem.addClass("subscribed"),subscribedLabel.removeAttr("hidden")):(discussionListItem.removeClass("subscribed"),subscribedLabel.attr("hidden",!0))})),root.on("click",Selectors.favourite.toggle,(function(){var toggleElement=$(this),forumId=toggleElement.data("forumid"),discussionId=toggleElement.data("discussionid"),subscriptionState=toggleElement.data("targetstate");Repository.setFavouriteDiscussionState(forumId,discussionId,subscriptionState).then((function(){return location.reload()})).catch(Notification.exception)})),root.on("click",Selectors.pin.toggle,(function(e){e.preventDefault();var toggleElement=$(this),forumId=toggleElement.data("forumid"),discussionId=toggleElement.data("discussionid"),state=toggleElement.data("targetstate");Repository.setPinDiscussionState(forumId,discussionId,state).then((function(){return location.reload()})).catch(Notification.exception)})),root.on("click",Selectors.lock.toggle,(function(e){var toggleElement=$(this),forumId=toggleElement.data("forumid"),discussionId=toggleElement.data("discussionid"),state=toggleElement.data("state");Repository.setDiscussionLockState(forumId,discussionId,state).then((function(context){var icon=toggleElement.parents(Selectors.summary.actions).find(Selectors.lock.icon),lockedLabel=toggleElement.parents(Selectors.discussion.item).find(Selectors.discussion.lockedLabel);return context.locked?(icon.removeClass("hidden"),lockedLabel.removeAttr("hidden")):(icon.addClass("hidden"),lockedLabel.attr("hidden",!0)),context})).then((function(context){return context.forumid=forumId,Templates.render("mod_forum/discussion_lock_toggle",context)})).then((function(html,js){return Templates.replaceNode(toggleElement,html,js)})).then((function(){return Str.get_string("lockupdated","forum").done((function(s){return Notification.addNotification({message:s,type:"info"})}))})).catch(Notification.exception),e.preventDefault()}))}(root)}}}));
define("mod_forum/discussion_list",["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository","core/pubsub","mod_forum/forum_events"],(function($,Templates,Str,Notification,SubscriptionToggle,Selectors,Repository,PubSub,ForumEvents){return{init:function(root){SubscriptionToggle.init(root,!1,(function(toggleElement,context){var toggleId=toggleElement.attr("id"),newTargetState=context.userstate.subscribed?0:1;toggleElement.data("targetstate",newTargetState);var stringKey=context.userstate.subscribed?"unsubscribediscussion":"subscribediscussion";return Str.get_string(stringKey,"mod_forum").then((function(string){return toggleElement.closest("td").find('label[for="'+toggleId+'"]').find("span").text(string),string}))})),function(root){PubSub.subscribe(ForumEvents.SUBSCRIPTION_TOGGLED,(function(data){var discussionId=data.discussionId,subscribed=data.subscriptionState,discussionListItem=root.find(Selectors.discussion.item+"[data-discussionid= "+discussionId+"]"),subscribedLabel=discussionListItem.find(Selectors.discussion.subscribedLabel);subscribed?(discussionListItem.addClass("subscribed"),subscribedLabel.removeAttr("hidden")):(discussionListItem.removeClass("subscribed"),subscribedLabel.attr("hidden",!0))})),root.on("click",Selectors.favourite.toggle,(function(e){e.preventDefault();var toggleElement=$(this),forumId=toggleElement.data("forumid"),discussionId=toggleElement.data("discussionid"),subscriptionState=toggleElement.data("targetstate");Repository.setFavouriteDiscussionState(forumId,discussionId,subscriptionState).then((function(){return location.reload()})).catch(Notification.exception)})),root.on("click",Selectors.pin.toggle,(function(e){e.preventDefault();var toggleElement=$(this),forumId=toggleElement.data("forumid"),discussionId=toggleElement.data("discussionid"),state=toggleElement.data("targetstate");Repository.setPinDiscussionState(forumId,discussionId,state).then((function(){return location.reload()})).catch(Notification.exception)})),root.on("click",Selectors.lock.toggle,(function(e){var toggleElement=$(this),forumId=toggleElement.data("forumid"),discussionId=toggleElement.data("discussionid"),state=toggleElement.data("state");Repository.setDiscussionLockState(forumId,discussionId,state).then((function(context){var icon=toggleElement.parents(Selectors.summary.actions).find(Selectors.lock.icon),lockedLabel=toggleElement.parents(Selectors.discussion.item).find(Selectors.discussion.lockedLabel);return context.locked?(icon.removeClass("hidden"),lockedLabel.removeAttr("hidden")):(icon.addClass("hidden"),lockedLabel.attr("hidden",!0)),context})).then((function(context){return context.forumid=forumId,Templates.render("mod_forum/discussion_lock_toggle",context)})).then((function(html,js){return Templates.replaceNode(toggleElement,html,js)})).then((function(){return Str.get_string("lockupdated","forum").done((function(s){return Notification.addNotification({message:s,type:"info"})}))})).catch(Notification.exception),e.preventDefault()}))}(root)}}}));
//# sourceMappingURL=discussion_list.min.js.map
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -56,7 +56,9 @@ define([
}
});
root.on('click', Selectors.favourite.toggle, function() {
root.on('click', Selectors.favourite.toggle, function(e) {
e.preventDefault();
var toggleElement = $(this);
var forumId = toggleElement.data('forumid');
var discussionId = toggleElement.data('discussionid');
@@ -5,32 +5,22 @@ Feature: An admin or teacher sets the post threshold for blocking and warning
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 1 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| forum | Test forum name | Test forum name | C1 | forum | 0 |
| activity | name | course | blockperiod | blockafter | warnafter |
| forum | Test forum name | C1 | 172800 | 3 | 2 |
@javascript
Scenario: A student should not be able to post new discussion or reply to the existing discussion once the threshold block count is reached
Given I am on the "Test forum name" "forum activity" page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And I set the field "Time period for blocking" to "2 days"
And I set the field "Post threshold for blocking" to "3"
And I set the field "Post threshold for warning" to "2"
And I press "Save and display"
And I log out
And I am on the "Test forum name" "forum activity" page logged in as student1
Given I am on the "Test forum name" "forum activity" page logged in as student1
When I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
@@ -60,15 +50,7 @@ Feature: An admin or teacher sets the post threshold for blocking and warning
@javascript
Scenario: A student should see warning when the post is about to reach threshold when experimental nested discussion view is set
Given I am on the "Test forum name" "forum activity" page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And I set the field "Time period for blocking" to "2 days"
And I set the field "Post threshold for blocking" to "3"
And I set the field "Post threshold for warning" to "2"
And I press "Save and display"
And I log out
And I am on the "Test forum name" "forum activity" page logged in as student1
Given I am on the "Test forum name" "forum activity" page logged in as student1
When I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
@@ -85,3 +67,34 @@ Feature: An admin or teacher sets the post threshold for blocking and warning
And I click on "Test post subject two" "link"
When I press "Reply"
Then I should see "You are approaching the posting threshold. You have posted 2 times in the last 2 days and the limit is 3 posts."
@javascript
Scenario: A student with 'mod/forum:postwithoutthrottling' capability should be able to post unlimited number of times
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/forum:postwithoutthrottling | Allow | student | Course | C1 |
And I am on the "Test forum name" "forum activity" page logged in as student1
And I should see "This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 3 posting(s) in 2 days"
When I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject two |
| Message | Test post message two |
And I should see "Add a new discussion topic"
# Verify that when navigated to one of the topics and then click reply the warning notification is shown.
And I click on "Test post subject two" "link"
And I click on "Reply" "link"
# With 'mod/forum:postwithoutthrottling' assigned capability the message below should not be displayed.
And I should not see "You are approaching the posting threshold. You have posted 2 times in the last 2 days and the limit is 3 posts."
And I click on "Test forum name" "link"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject three |
| Message | Test post message three |
Then I should see "Add a new discussion topic"
# Verify that reply link is available in the posts.
And I click on "Test post subject three" "link"
And I should see "Reply"
And I am on the "Test forum name" "forum activity" page
And I click on "Test post subject two" "link"
And I should see "Reply"
@@ -0,0 +1,69 @@
@mod @mod_forum
Feature: Forum posts display word count
In order to display forum word count
As a teacher
I need to be able to update forum and set "Display word count" to Yes
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | t1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: Forum posts display word count for single simple discussion forum
Given the following "activities" exist:
| activity | course | name | type | displaywordcount | intro |
| forum | C1 | Forum 1 | single | 1 | Single forum post |
When I am on the "Forum 1" "forum activity" page logged in as teacher1
Then I should see "3 words"
And I am on the "Forum 1" "forum activity editing" page
And I expand all fieldsets
And I set the field "Display word count" to "No"
And I press "Save and display"
And I am on the "Forum 1" "forum activity" page
And I should not see "3 words"
Scenario: Forum posts display word count for blog-like forum
Given the following "activities" exist:
| activity | course | name | type | displaywordcount |
| forum | C1 | Forum 1 | blog | 1 |
And the following "mod_forum > discussions" exist:
| forum | name | subject | message |
| Forum 1 | Blog Forum | Blog Forum | This is a blog forum post |
When I am on the "Forum 1" "forum activity" page logged in as teacher1
Then I should see "6 words"
And I am on the "Forum 1" "forum activity editing" page
And I expand all fieldsets
And I set the field "Display word count" to "No"
And I press "Save and display"
And I am on the "Forum 1" "forum activity" page
And I should not see "6 words"
Scenario Outline: Forum posts display word count for other forum types
Given the following "activities" exist:
| activity | course | name | type | displaywordcount |
| forum | C1 | Forum 1 | <type> | 1 |
And the following "mod_forum > discussions" exist:
| forum | name | subject | message |
| Forum 1 | <typeext> | <typeext> | <message> |
When I am on the "Forum 1" "forum activity" page logged in as teacher1
And I follow "<typeext>"
Then I should see "<count> words"
And I am on the "Forum 1" "forum activity editing" page
And I expand all fieldsets
And I set the field "Display word count" to "No"
And I press "Save and display"
And I am on the "Forum 1" "forum activity" page
And I follow "<typeext>"
Then I should not see "<count> words"
Examples:
| type | typeext | message | count |
| general | General Forum | General discussion in forum | 4 |
| eachuser | Each User Forum | This is an each user forum post | 7 |
| qanda | Q and A Forum | This is a Q and A type forum | 8 |
+2 -2
View File
@@ -115,7 +115,7 @@ class entities_discussion_test extends \advanced_testcase {
* Test the display period settings for discussions.
* This covers each individual date function as well as the combination of the 2.
*
* @dataProvider test_diplay_period_options_provider
* @dataProvider diplay_period_options_provider
* @param string $testdescription A basic description of the base assertions.
* @param int $startoffset Start time offset with current time in seconds.
* @param int $endoffset End time offset with current time in seconds.
@@ -159,7 +159,7 @@ class entities_discussion_test extends \advanced_testcase {
*
* @return array start/end time offsets and the expected results.
*/
public function test_diplay_period_options_provider() {
public function diplay_period_options_provider() {
return array(
["No dates set", 0, 0, true, false, true],
["Only started date in the future", 100, 0, false, false, false],
@@ -21,18 +21,12 @@ Feature: Numeric and short answer questions have a section to catch all other st
| course | C1 |
| idnumber | 0001 |
| name | Test lesson name |
| intro | Test lesson description |
| section | 1 |
| maxattempts | 3 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
When I navigate to "Edit settings" in current page administration
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the following fields to these values:
| Provide option to try a question again | Yes |
And I press "Save and return to course"
And I follow "Test lesson name"
And I press "Save and display"
Scenario: I can create a numerical question with an option to catch all student responses.
Given I follow "Add a question page"
@@ -53,10 +47,7 @@ Feature: Numeric and short answer questions have a section to catch all other st
| id_answer_editor_0 | End this lesson |
| id_jumpto_0 | End of lesson |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I set the field "Your answer" to "5"
And I press "Submit"
And I should see "That's the wrong answer"
@@ -87,10 +78,7 @@ Feature: Numeric and short answer questions have a section to catch all other st
| id_answer_editor_0 | End this lesson |
| id_jumpto_0 | End of lesson |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I set the field "Your answer" to "dog"
And I press "Submit"
And I should see "That's the wrong answer"
@@ -21,22 +21,18 @@ Feature: Set end of lesson reached as a completion condition for a lesson
| course | C1 |
| idnumber | 0001 |
| name | Test lesson |
| intro | Test lesson description |
| section | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Enable completion tracking | Yes |
And I press "Save and display"
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
And I am on the "Test lesson" "lesson activity editing" page
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| completionview | 0 |
| completionendreached | 1 |
And I press "Save and return to course"
And I follow "Test lesson"
And I press "Save and display"
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -53,16 +49,13 @@ Feature: Set end of lesson reached as a completion condition for a lesson
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
Then the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "todo"
And I follow "Test lesson"
And I press "Next page"
And I am on "Course 1" course homepage
And the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "todo"
And I am on "Course 1" course homepage
And I follow "Test lesson"
And I am on the "Test lesson" "lesson activity" page
And I should see "You have seen more than one page of this lesson already."
And I should see "Do you want to start at the last page you saw?"
And I click on "No" "link" in the "#page-content" "css_element"
@@ -70,7 +63,5 @@ Feature: Set end of lesson reached as a completion condition for a lesson
And I press "Next page"
And I am on "Course 1" course homepage
And the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as teacher1
And "Student 1" user has completed "Test lesson" activity
@@ -21,24 +21,19 @@ Feature: Set time spent as a completion condition for a lesson
| course | C1 |
| idnumber | 0001 |
| name | Test lesson |
| intro | Test lesson description |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Enable completion tracking | Yes |
And I press "Save and display"
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
And I am on the "Test lesson" "lesson activity editing" page
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| completionview | 0 |
| completiontimespentenabled | 1 |
| completiontimespent[timeunit] | 1 |
| completiontimespent[number] | 10 |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I follow "Test lesson"
| completiontimespent[number] | 5 |
And I press "Save and display"
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -55,28 +50,23 @@ Feature: Set time spent as a completion condition for a lesson
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Then the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
When I am on the "Course 1" course page logged in as student1
Then the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
And I follow "Test lesson"
And I press "Next page"
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
And I wait "1" seconds
And I press "Next page"
And I should see "You completed this lesson in"
And I should see ", which is less than the required time of 10 secs. You might need to attempt the lesson again."
And I should see ", which is less than the required time of 5 secs. You might need to attempt the lesson again."
And I am on "Course 1" course homepage
And the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
And I am on "Course 1" course homepage
And I follow "Test lesson"
And the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
And I am on the "Test lesson" "lesson activity" page
And I press "Next page"
And I wait "11" seconds
And I wait "5" seconds
And I press "Next page"
And I should not see "You might need to attempt the lesson again."
And I am on "Course 1" course homepage
And the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "done"
And I am on the "Course 1" course page logged in as teacher1
And "Student 1" user has completed "Test lesson" activity
@@ -16,16 +16,14 @@ Feature: A teacher can set available from and deadline dates to access a lesson
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | course | idnumber |
| lesson | Test lesson | C1 | lesson1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Forbidding lesson accesses until a specified date
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| lesson | Test lesson | Test lesson description | C1 | 1 | lesson1 |
And I am on "Course 1" course homepage
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson" "lesson activity editing" page
And I set the field "id_available_enabled" to "1"
And I set the following fields to these values:
| available[day] | 1 |
@@ -33,28 +31,19 @@ Feature: A teacher can set available from and deadline dates to access a lesson
| available[year] | 2030 |
| available[hour] | 08 |
| available[minute] | 00 |
And I press "Save and return to course"
And I follow "Test lesson"
And I press "Save and display"
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
| Page contents | First page contents |
| Description | The first one |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test lesson"
When I am on the "Test lesson" "lesson activity" page logged in as student1
Then the activity date in "Test lesson" should contain "Opens: Tuesday, 1 January 2030, 8:00"
And I should not see "First page contents"
Scenario: Forbidding lesson accesses after a specified date
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| lesson | Test lesson | Test lesson description | C1 | 1 | lesson1 |
And I am on "Course 1" course homepage
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson" "lesson activity editing" page
And I set the field "id_deadline_enabled" to "1"
And I set the following fields to these values:
| deadline[day] | 1 |
@@ -62,17 +51,13 @@ Feature: A teacher can set available from and deadline dates to access a lesson
| deadline[year] | 2000 |
| deadline[hour] | 08 |
| deadline[minute] | 00 |
And I press "Save and return to course"
And I follow "Test lesson"
And I press "Save and display"
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
| Page contents | First page contents |
| Description | The first one |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test lesson"
When I am on the "Test lesson" "lesson activity" page logged in as student1
Then the activity date in "Test lesson" should contain "Closed: Saturday, 1 January 2000, 8:00"
And I should not see "First page contents"
@@ -20,18 +20,20 @@ Feature: Display the lesson description in the lesson and optionally in the cour
| idnumber | 0001 |
| name | Test lesson name |
| intro | Test lesson description |
| section | 1 |
And I log in as "teacher1"
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | Test lesson part 1 |
| Description | Lesson part 1 description |
| Jump | Next page |
And I click on "Save page" "button"
Scenario: Description is displayed in the Lesson
Given I am on "Course 1" course homepage
When I follow "Test lesson"
When I am on the "Test lesson name" "lesson activity" page
Then I should see "Test lesson description"
Scenario: Show lesson description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson name" "lesson activity editing" page
And the following fields match these values:
| Display description on course page | |
And I set the following fields to these values:
@@ -41,9 +43,7 @@ Feature: Display the lesson description in the lesson and optionally in the cour
Then I should see "Test lesson description"
Scenario: Hide lesson description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson name" "lesson activity editing" page
And the following fields match these values:
| Display description on course page | |
And I press "Save and return to course"
@@ -44,7 +44,6 @@ Feature: View activity completion in the lesson activity
| Jump | End of lesson |
| Score | 1 |
And I press "Save page"
And I log out
Scenario: View automatic completion items as a teacher
When I am on the "Music history" "lesson activity" page logged in as teacher1
@@ -82,7 +81,6 @@ Feature: View activity completion in the lesson activity
And I press "Save and display"
# Teacher view.
And the manual completion button for "Music history" should be disabled
And I log out
# Student view.
When I am on the "Music history" "lesson activity" page logged in as student1
Then the manual completion button of "Music history" is displayed as "Mark as done"
@@ -16,11 +16,9 @@ Feature: Teachers can review student progress on all lessons in a course by view
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | retake |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
| activity | name | course | idnumber | retake |
| lesson | Test lesson name | C1 | lesson1 | 1 |
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
Scenario: View student progress for lesson that was never attempted
Given I follow "Add a content page"
@@ -80,14 +78,10 @@ Feature: Teachers can review student progress on all lessons in a course by view
| id_jumpto_1 | Next page |
And I press "Save page"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I log out
Then I log in as "teacher1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as teacher1
And I navigate to course participants
And I follow "Student 1"
And I follow "Complete report"
@@ -138,10 +132,7 @@ Feature: Teachers can review student progress on all lessons in a course by view
| id_answer_editor_1 | Next page |
| id_jumpto_1 | Next page |
And I press "Save page"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I should see "Second page contents"
@@ -157,9 +148,7 @@ Feature: Teachers can review student progress on all lessons in a course by view
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I log out
Then I log in as "teacher1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as teacher1
And I navigate to course participants
And I follow "Student 1"
And I follow "Complete report"
@@ -185,17 +174,12 @@ Feature: Teachers can review student progress on all lessons in a course by view
| id_answer_editor_1 | End of lesson |
| id_jumpto_1 | End of lesson |
And I press "Save page"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I should see "Second page contents"
And I press "End of lesson"
And I log out
Then I log in as "teacher1"
And I am on "Course 1" course homepage
Then I am on the "Course 1" course page logged in as teacher1
And I navigate to course participants
And I follow "Student 1"
And I follow "Complete report"
@@ -23,8 +23,8 @@ Feature: Lesson reset
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Add a question page"
And I set the field "Select a question type" to "True/false"
@@ -41,15 +41,13 @@ Feature: Lesson reset
And I press "Save page"
Scenario: Use course reset to clear all attempt data
When I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
When I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "Cat is an amphibian"
And I set the following fields to these values:
| False | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I navigate to "Reports > Overview" in current page administration
And I should see "Sam1 Student1"
@@ -18,11 +18,9 @@ branch table contents
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -55,11 +53,8 @@ branch table contents
| id_answer_editor_1 | |
And I press "Save page"
And I should not see "Previous page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I should see "First page contents"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "First page contents"
And I should not see "Previous page"
And I press "Next page"
And I should see "1 + 1?"
@@ -78,11 +73,8 @@ branch table contents
| id_answer_editor_1 | |
And I press "Save page"
And I should not see "Incorrect answer"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I should see "First page contents"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "First page contents"
And I press "Next page"
And I should see "1 + 1?"
And I set the following fields to these values:
@@ -17,11 +17,9 @@ Feature: In a lesson activity, teacher can edit a cluster page
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| lesson | Lesson with cluster | Test lesson description | C1 | lesson1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Lesson with cluster"
| activity | name | course | idnumber |
| lesson | Lesson with cluster | C1 | lesson1 |
And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -87,10 +85,7 @@ Feature: In a lesson activity, teacher can edit a cluster page
| id_jumpto_0 | Second page name |
And I press "Save page"
And I should see "Modified end"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Lesson with cluster"
And I am on the "Lesson with cluster" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I should see "Question from cluster"
@@ -17,11 +17,9 @@ Feature: In a lesson activity, teacher can edit lesson's pages
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -67,10 +65,7 @@ Feature: In a lesson activity, teacher can edit lesson's pages
And I press "Save page"
Then I should see "Modified second page"
And I should not see "Second page name"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I should see "Modified contents"
@@ -106,10 +101,7 @@ Feature: In a lesson activity, teacher can edit lesson's pages
And I press "Save page"
Then I should see "New hardest question"
And I should not see "Hardest question ever"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I should see "Second page contents"
@@ -16,11 +16,9 @@ Feature: In a lesson activity, teacher can add an essay question
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section | feedback |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test lesson name"
| activity | name | course | idnumber | feedback |
| lesson | Test lesson name | C1 | lesson1 | 1 |
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Add a question page"
And I set the field "Select a question type" to "Essay"
And I press "Add a question page"
@@ -28,10 +26,7 @@ Feature: In a lesson activity, teacher can add an essay question
| Page title | Essay question |
| Page contents | <p>Please write a story about a <b>frog</b>.</p> |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "Please write a story about a frog."
And I set the field "Your answer" to "<p>Once upon a time there was a little <b>green</b> frog."
And I press "Submit"
@@ -43,10 +38,7 @@ Feature: In a lesson activity, teacher can add an essay question
And I should see "You earned 0 out of 0 for the automatically graded questions."
And I should see "Your 1 essay question(s) will be graded and added into your final score at a later date."
And I should see "Your current grade without the essay question(s) is 0 out of 1."
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Grade essays"
And I should see "Student 1"
And I should see "Essay question"
@@ -16,11 +16,9 @@ Feature: In a lesson activity, students can exit and re-enter the activity when
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Lesson with cluster | Cluster lesson description | C1 | lesson1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Lesson with cluster"
| activity | name | course | idnumber |
| lesson | Lesson with cluster | C1 | lesson1 |
And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -185,12 +183,9 @@ Feature: In a lesson activity, students can exit and re-enter the activity when
| id_score_1 | 0 |
And I press "Save page"
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][16]" "xpath_element"
And I log out
Scenario: Accessing as student to a cluster only lesson
Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Lesson with cluster"
Given I am on the "Lesson with cluster" "lesson activity" page logged in as student1
And I should see "First page contents"
And I press "Next page"
And I should see "Correct answer"
@@ -30,8 +30,8 @@ Feature: Lesson group override
| student2 | G2 |
| student3 | G1 |
And the following "activities" exist:
| activity | name | intro | groupmode | course | idnumber |
| lesson | Test lesson name | Test lesson description | 1 | C1 | lesson1 |
| activity | name | groupmode | course | idnumber |
| lesson | Test lesson name | 1 | C1 | lesson1 |
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I follow "Add a question page"
And I set the field "Select a question type" to "True/false"
@@ -46,7 +46,6 @@ Feature: Lesson group override
| id_response_editor_1 | Wrong |
| id_jumpto_1 | This page |
And I press "Save page"
And I log out
Scenario: Add, modify then delete a group override
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
@@ -105,7 +104,6 @@ Feature: Lesson group override
| Re-takes allowed | 1 |
And I press "Save"
And I should see "Re-takes allowed"
And I log out
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "Cat is an amphibian"
And I set the following fields to these values:
@@ -116,7 +114,6 @@ Feature: Lesson group override
And I am on the "Test lesson name" "lesson activity" page
Then I should not see "You are not allowed to retake this lesson."
And I should see "Cat is an amphibian"
And I log out
Given I am on the "Test lesson name" "lesson activity" page logged in as student2
And I should see "Cat is an amphibian"
And I set the following fields to these values:
@@ -140,7 +137,6 @@ Feature: Lesson group override
| Password protected lesson | 12345 |
And I press "Save"
And I should see "Password protected lesson"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "Test lesson name is a password protected lesson"
And I should not see "Cat is an amphibian"
@@ -156,7 +152,6 @@ Feature: Lesson group override
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student2
And I should see "Test lesson name is a password protected lesson"
And I should not see "Cat is an amphibian"
@@ -189,11 +184,9 @@ Feature: Lesson group override
| deadline[minute] | 00 |
And I press "Save"
And I should see "Lesson closes"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student2
Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00"
And I should not see "Cat is an amphibian"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "Cat is an amphibian"
@@ -219,11 +212,9 @@ Feature: Lesson group override
| available[minute] | 00 |
And I press "Save"
And I should see "Lesson opens"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student2
Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00"
And I should not see "Cat is an amphibian"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "Cat is an amphibian"
@@ -239,7 +230,6 @@ Feature: Lesson group override
| Maximum number of attempts per question | 2 |
And I press "Save"
And I should see "Maximum number of attempts per question"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "Cat is an amphibian"
And I set the following fields to these values:
@@ -252,7 +242,6 @@ Feature: Lesson group override
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student2
And I should see "Cat is an amphibian"
And I set the following fields to these values:
@@ -298,13 +287,10 @@ Feature: Lesson group override
| available[minute] | 00 |
And I press "Save"
And I should see "Wednesday, 1 January 2031, 8:00"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And the activity date in "Test lesson name" should contain "Opens: Wednesday, 1 January 2031, 8:00"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student2
And the activity date in "Test lesson name" should contain "Opens: Sunday, 1 January 2040, 8:00"
And I log out
And I am on the "Test lesson name" "lesson activity" page logged in as student3
And the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00"
@@ -367,7 +353,6 @@ Feature: Lesson group override
| available[hour] | 08 |
| available[minute] | 00 |
And I press "Save"
And I log out
And I am on the "Lesson 2" "lesson activity" page logged in as teacher1
And I navigate to "Group overrides" in current page administration
Then I should see "Group 1" in the ".generaltable" "css_element"
@@ -18,15 +18,13 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | 1 | lesson1 |
And I log in as "teacher1"
And I am on the "Test lesson name" "lesson activity editing" page
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
And I set the following fields to these values:
| Maximum grade | 75 |
| Custom scoring | No |
And I press "Save and return to course"
And I follow "Test lesson name"
And I press "Save and display"
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -59,8 +57,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
And I log in as "student1"
Scenario: Informations at end of lesson if custom scoring not enabled
Given I am on "Course 1" course homepage
And I follow "Test lesson name"
Given I am on the "Test lesson name" "lesson activity" page
And I should see "First page contents"
When I press "Next page"
And I should see "1 + 1?"
@@ -79,8 +76,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
Given the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | # |
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page
And I should see "First page contents"
When I press "Next page"
And I should see "1 + 1?"
@@ -96,8 +92,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
And I should see "Your current grade is 0#0 out of 75"
Scenario: Current grade is displayed at end of lesson when grade type is set to scale
Given I am on "Course 1" course homepage
And I follow "Test lesson name 2"
Given I am on the "Test lesson name 2" "lesson activity" page
When I press "Next page"
And I should see "1 + 1?"
And I set the following fields to these values:
@@ -16,14 +16,13 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
And I log in as "teacher1"
Scenario: Student navigation with pages and questions
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
And I am on "Course 1" course homepage
And I follow "Test lesson name"
Given I am on the "Test lesson name" "lesson activity" page
And I follow "Add a content page"
And I set the following fields to these values:
| Page title | First page name |
@@ -56,10 +55,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| id_jumpto_1 | Second page name |
| id_score_1 | 0 |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "First page contents"
And I press "Next page"
And I should see "Second page contents"
@@ -88,17 +84,11 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I should see "Your score is 0 (out of 1)."
Scenario: Student reattempts a question until out of attempts
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson name" "lesson activity editing" page
And I set the following fields to these values:
| id_review | Yes |
| id_maxattempts | 3 |
And I press "Save and return to course"
And I follow "Test lesson name"
And I press "Save and display"
And I follow "Add a question page"
And I set the following fields to these values:
| id_qtype | True/false |
@@ -109,10 +99,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| id_answer_editor_0 | right |
| id_answer_editor_1 | wrong |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "Test content"
And I set the following fields to these values:
| wrong | 1 |
@@ -134,16 +121,11 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I should see "Congratulations - end of lesson reached"
Scenario: Student reattempts a question until out of attempts with specific jumps
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
And I am on the "Test lesson name" "lesson activity" page
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson name" "lesson activity editing" page
And I set the following fields to these values:
| id_review | Yes |
| id_maxattempts | 3 |
And I press "Save and return to course"
And I follow "Test lesson name"
And I press "Save and display"
And I follow "Add a question page"
And I set the following fields to these values:
| id_qtype | True/false |
@@ -165,7 +147,6 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| id_answer_editor_1 | wrong |
| id_jumpto_1 | Test question |
And I press "Save page"
And I log out
When I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "Test content 1"
And I set the following fields to these values:
@@ -192,17 +173,11 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I should see "Test content 1"
Scenario: Student should not see remaining attempts notification if maximum number of attempts is set to unlimited
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson name" "lesson activity editing" page
And I set the following fields to these values:
| id_review | Yes |
| id_maxattempts | 0 |
And I press "Save and return to course"
And I follow "Test lesson name"
And I press "Save and display"
And I follow "Add a question page"
And I set the following fields to these values:
| id_qtype | True/false |
@@ -213,10 +188,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| id_answer_editor_0 | right |
| id_answer_editor_1 | wrong |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test lesson name"
When I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "Test content"
And I set the following fields to these values:
| wrong | 1 |
@@ -19,21 +19,14 @@ Feature: Lesson with no calendar capabilites
| course | C1 |
| idnumber | 0001 |
| name | Test lesson name |
| intro | Test lesson description |
| section | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as admin
And I navigate to "Users > Permissions" in current page administration
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |
And I log out
Scenario: Editing a lesson
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test lesson name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test lesson name" "lesson activity editing" page logged in as admin
And I set the following fields to these values:
| id_available_enabled | 1 |
| id_available_day | 1 |
@@ -44,11 +37,7 @@ Feature: Lesson with no calendar capabilites
| id_deadline_month | 2 |
| id_deadline_year | 2017 |
And I press "Save and return to course"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test lesson name"
And I navigate to "Edit settings" in current page administration
When I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
And I set the following fields to these values:
| id_available_year | 2018 |
| id_deadline_year | 2018 |
@@ -26,12 +26,8 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
| course | C1 |
| idnumber | 0001 |
| name | Test lesson name |
| intro | Test lesson description |
| retake | 1 |
| section | 1 |
And I am on "Course 1" course homepage
And I follow "Test lesson name"
When I navigate to "Edit settings" in current page administration
When I am on the "Test lesson name" "lesson activity editing" page
And I expand all fieldsets
And I set the following fields to these values:
| id_deadline_enabled | 1 |
@@ -40,8 +36,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
| deadline[year] | 2030 |
| deadline[hour] | 08 |
| deadline[minute] | 00 |
And I press "Save and return to course"
And I follow "Test lesson name"
And I press "Save and display"
And I follow "Add a question page"
And I set the field "Select a question type" to "True/false"
And I press "Add a question page"
@@ -82,10 +77,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
| id_response_editor_1 | Wrong |
| id_jumpto_1 | This page |
And I press "Save page"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
And I should see "Cat is an amphibian"
And I set the following fields to these values:
| False | 1 |
@@ -122,10 +114,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 3 (out of 3)."
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test lesson name"
And I am on the "Test lesson name" "lesson activity" page logged in as student2
And I should see "Cat is an amphibian"
And I set the following fields to these values:
| True | 1 |
@@ -143,4 +132,3 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 2 (out of 3)."
And I log out

Some files were not shown because too many files have changed in this diff Show More