190 Commits

Author SHA1 Message Date
Paul Holden
40c574cd74 MDL-73988 reportbuilder: support for getting entity joins in reports.
This allow reports using multiple entities to more easily define the
relationship between them, specifically when they share common joined
tables.
2022-05-19 16:35:09 +01:00
David Matamoros
5e68da7868 MDL-74497 reportbuilder: Use new methods in existing datasources
- Replace all individual calls to add all columns, filters and
conditions on the cohorts datasource with the new
method add_all_from_entities().

- Replace all individual calls to add all columns, filters and
conditions on the courses datasource with the new
method add_all_from_entities().

- Replace all individual calls to add all columns, filters and
conditions on the users datasource with the new
method add_all_from_entity().
2022-05-13 08:36:31 +02:00
Sujith Haridasan
aa1c2e2382 MDL-73848 administration: Fix the breadcrumbs and nav highlights
Create or update the breadcrumbs in the site administration
pages where it is required.
Highlight the corresponding site adminstration tab.
Highlight the primary nav to Site administration when user
is navigating to any of the site administration pages.

Also changed the boostnavbar so that the nodes in the secondary
navigation are not shown in the breadcrumbs when user is in site
administration page.
2022-03-25 17:44:47 +08:00
Paul Holden
b73a69b920 MDL-74175 cohort: correct type/callback of entity category column. 2022-03-15 15:28:54 +00:00
Eloy Lafuente (stronk7)
4003e31983 MDL-73785 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- When belonging to other components and being valid api:
  - analytics related tests have been moved to tests/analytics subdir.
  - backup & restore related tests have been moved to tests/backup subdir.
  - events related tests have been moved to tests/event subdir.
  - privacy related tests have been moved to tests/privacy.
  - task related tests have been moved to tests/task subdir.
- Some simple renames, not including the component part anymore (not
  needed now that they are namespaced):
  - some xxxlib_test.php have been renamed lib_test.php
    (when they where testing the corresponding lib.php).
  - cache stores tests have been all renamed store_test, originally
    each one had its own name (file_test, apcu_test, redis_test...)
  - assign feedback tests have been all renamed feedback_test, originally
    each one had its own name (file_test, editpdf_test...)
2022-03-03 12:19:30 +01:00
Mihail Geshoski
0cbe8704ee MDL-73169 core_cohort: Update course category breadcrumb nodes 2022-03-02 17:27:38 +08:00
Eloy Lafuente (stronk7)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01:00
abgreeve
fcd4de8639 MDL-72090 navigation: Update to behat feature files for navigation.
This updates feature files to use the new steps to navigate to certain
pages.
2021-12-09 11:13:35 +08:00
Mikel Martín
6a6ebbac63 MDL-72770 reportbuilder: Display editor in full screen layout
- use 'popup' layout in editor page and create a custom navbar
- remove 'Settings' toggle button and show settings right sidebar with fixed position
- add 'Edit details' button on navbar that opens a modal to modify report basic settings
2021-12-01 17:12:45 +01:00
Paul Holden
881dccaa7d MDL-73069 reportbuilder: filter/condition for selecting user.
This allows a report creator to create personalised reports
according to the user who is viewing the report.
2021-11-22 09:17:52 +00:00
Paul Holden
7071e4dfd4 MDL-72172 reportbuilder: fix cohort report source tests.
Choose aggregation method that has availability across all
supported databases; and allows sorting.

"Comma separated distinct values" doesn't fulfill either of
these criteria.
2021-11-01 15:42:35 +02:00
Ilya Tregubov
2b45c78426 Merge branch 'MDL-72172-master' of git://github.com/dravek/moodle 2021-11-01 07:26:34 +01:00
David Matamoros
70085ef7ac MDL-72588 reportbuilder: implement audience helpers and classes.
Create the base audience class, to be extended by all audience types
across the site. Implement types allowing audiences to be created per
user, cohort or system role assignment.

The helper class is used for interrogating report audience instances
and retrieving access lists of those users able to view specific
reports.

Co-authored-by: Paul Holden <paulh@moodle.com>
2021-10-29 12:28:24 +02:00
Paul Holden
bbf95413fb MDL-72172 cohort: implement cohort datasource for custom reporting.
Create two entities exposing reportable data on site cohorts and
their members, via column and filter definitions.

Create report source bringing them together along with the user
entity to provide data for the reportbuilder editor.

Co-authored-by: Carlos Castillo <carlos.castillo@moodle.com>
2021-10-26 15:36:36 +02:00
Paul Holden
0645319e62 MDL-72309 course: make category a required field in forms.
Course category fields were changed en masse from simple select
elements to autocompletes in 93d72205, but weren't defined as
required fields. This could lead to exceptions and/or unexpected
behaviour if their values were cleared prior to form submission.
2021-10-04 08:11:32 +01:00
Jun Pataleta
385438b463 Merge branch 'MDL-72589' of https://github.com/stronk7/moodle 2021-09-16 09:46:56 +08:00
Eloy Lafuente (stronk7)
9f9fe79c26 MDL-72589 behat: Add @skip_chrome_zerosize to failing scenarios
All the scenarios failing with Chrome zero-size errors are
getting the @skip_chrome_zerosize to be able to keep them apart from
regular runs. See MDL-71108 for more information about
that error.

They will be run by another job, specifically using that tag to
keep them failing and under control.
2021-09-15 20:25:11 +02:00
Sara Arjona
3f2f2e85bb MDL-72115 course: Rename Miscellaneous category
The "Miscellaneous" course category has been renamed to Category 1.
Besides, the description field has been set from FORMAT_MOODLE to
FORMAT_HTML.
2021-09-13 08:36:17 +02:00
Adrian Greeve
7d435fb5f2 MDL-70196 navigation: Update to feature files.
- Part of: MDL-69588
A lot of tests rely on the last element of the breadcrumb being
active. This updates feature files to not rely on this anymore.
2021-08-23 17:46:38 +08:00
Paul Holden
42a59cbc66 MDL-71661 cohort: support custom user profile fields. 2021-05-24 15:02:35 +01:00
Eloy Lafuente (stronk7)
8a14a7bd22 MDL-71036 phpunit: assertContains() now performs strict comparison
The methods assertContains() and assertNotContains() now perform
strict (type and value) comparison, pretty much like assertSame()
does.

A couple of new assertContainsEquals() and assertNotContainsEquals()
methods have been created to provide old (non-strict) behavior, pretty
much like assertEquals() do.

Apart from replacing the calls needing a relaxed comparison to those
new methods, there are also a couple of alternative, about how to
fix this, depending of every case:

- If the test is making any array_values() conversion, then it's better
  to remove that conversion and use assertArrayHasKey(), that is not
  strict.
- Sometimes if may be also possible to, simply, cast the expectation
  to the exact type coming in the array. I've not applied this technique
  to any of the cases in core.

Link: https://github.com/sebastianbergmann/phpunit/issues/3426
2021-03-11 23:04:31 +01:00
Luca Bösch
e25c56ac94 MDL-70578 cohorts: Add bootstrap classes to buttons 2021-01-08 07:28:34 +01:00
Andrew Nicols
0d580d2b3e MDL-67668 behat: Update tests for inplace editable field type 2020-11-23 09:01:19 +08:00
Andrew Nicols
ba34d6e225 MDL-70148 behat: Update steps for keyboard 2020-11-17 15:14:43 +08:00
Eloy Lafuente (stronk7)
40de097e65 MDL-67673 phpunit: Remove deprecated assertContains() uses on strings
Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
d95c378771 MDL-67673 phpunit: Remove expectedException annotations
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
f6711bb394 MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:45:59 +02:00
Bas Brands
702d1ed5f8 MDL-69454 core_search: consistent cohort search 2020-09-21 11:54:53 +02:00
Julien Boulen
93d7220587 MDL-67278 course: Use autocomplete widget for course category selector 2020-09-02 15:30:34 +02:00
Paul Holden
1d4dbcde96 MDL-69493 cohort: remove escaping of return URL params. 2020-08-17 21:22:02 +01:00
Marina Glancy
5ecbc5d9f7 MDL-65782 roles: allow several roles with user/frontpage archetype 2019-06-04 11:49:23 +02:00
Dan Marsden
c509d10821 MDL-64708 cohort: Return url is not used anywhere in core. 2019-05-08 17:54:44 +02:00
Shamim Rezaie
0c8cb62e8e MDL-64782 core_cohort: Performance improvement 2019-04-23 17:01:48 +10:00
Mathew May
5cac5fa428 MDL-64506 templates: BS2 m-x-x to BS4 mx-x 2019-04-03 19:47:11 +08:00
Mathew May
e00f1c663c MDL-64506 phpunit: Update unit tests to use classic 2019-04-03 19:34:20 +08:00
Andrew Nicols
f98a300dd8 MDL-62514 behat: Add additional autocomplete validation 2019-01-30 08:24:32 +08:00
Andrew Nicols
0616f045c3 MDL-53566 core: Add support for context locking
This chagne adds support for a new feature known as Context Locking.
This allows a context to be locked, thereby removing all write
capabilities for all users (including admin) for that context, and all
child contexts.
2018-11-13 21:17:40 +08:00
Mihail Geshoski
0395106340 MDL-63621 core_cohort: Add support for removal of context users
This issue is part of the MDL-62560 Epic.
2018-10-22 12:50:14 +02:00
Marina Glancy
442f12f81a MDL-62742 core: rename coursecat->core_course_category
Also rename course_in_list -> core_course_list_element
Deprecate class coursecat_sortable_records
2018-08-28 11:36:23 +02:00
Víctor Déniz Falcón
02fda279ed MDL-57281 behat: deprecated step definition I navigate to node in
Definition step deprecated and affected tests modified.
2018-08-20 12:53:26 +01:00
Luke Carrier
6b6fd4b0b7 MDL-61238 cohort: require_once all libraries 2018-08-15 00:12:38 +02:00
David Monllao
85218c28e9 Merge branch 'MDL-62228_master' of git://github.com/markn86/moodle 2018-05-15 13:31:07 +02:00
Mark Nelson
df1714f25a MDL-62228 core: remove unnecessary context check in privacy providers 2018-05-14 18:33:29 +08:00
Mark Nelson
8e24041287 MDL-62428 core: fix incorrect early return in privacy providers 2018-05-14 13:06:29 +08:00
Sara Arjona
5a86bf1448 MDL-61998 cohort: Implement privacy API 2018-04-23 11:41:04 +02:00
Andrew Nicols
853508eed3 MDL-61601 cohort: Move theme test to moodle_page 2018-04-09 10:16:54 +08:00
Sara Arjona
88cb8b781d MDL-61601 cohort: Add theme support for cohorts
If enabled $CFG->allowcohortthemes, then themes can be set at the cohort level.
This will affect all users with only one cohort or more than one but with the same theme.
The default theme order will be: course, category, session, user, cohort, site.
2018-04-06 08:28:01 +02:00
Dan Marsden
6b7d74040a MDL-49417 enrol_cohort: fix behat test to use new autocomplete. 2018-03-13 12:37:43 +13:00