307 Commits

Author SHA1 Message Date
Jun Pataleta
9320787005 MDL-46267 core: Remove $CFG->httpswwwroot
* It's unnecessary since $CFG->loginhttps has already been removed and
  it's no longer being used in core anymore.
2019-07-22 10:59:42 +08:00
Andrew Nicols
fc1785b086 MDL-60978 testing: Support ability to run phpunit in isolated process 2019-06-21 14:36:13 +08:00
Jun Pataleta
6bcc5dfdb4 MDL-65204 phpunit: Fix valid CiBoT errors and warnings 2019-04-03 10:44:24 +08:00
Eloy Lafuente (stronk7)
032c75ec43 MDL-65204 phpunit: tweak constraint_object_is_equal_with_exceptions
In PHPUnit 7.x and above, IsEqual->value became private and, as far
as our with exceptions class inherits from it, we cannot access to
that anymore.

So, in order to avoid that, we are overriding the constructor, capturing
the original value for own use and forgetting.

A more formal, alternative, solution would be to make our
exceptional class to inherit from Constraint and make the
class a pure dispatcher to different constraints, with IsEqual being
just one of them.

But we followed the easiest path here. Not ideal, but efective.
2019-04-03 10:39:19 +08:00
Eloy Lafuente (stronk7)
26218b7852 MDL-65204 phpunit: make testcases match their expected signature 2019-04-03 10:39:19 +08:00
Andrew Nicols
0970aa10af MDL-63366 core_phpunit: Add ability to specify coverage filters 2019-03-01 10:30:31 +08:00
Marcus Boon
f33a614ec6 MDL-64599 phpunit: Fix typo in arraydataset 2019-01-18 07:07:25 +10:00
Jun Pataleta
7a99ff70b9 Merge branch 'MDL-63811' of git://github.com/aolley/moodle 2018-11-15 17:09:28 +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
Adam Olley
edd51eb245 MDL-63811 phpunit: Fix typo in new allowed config variable
Without this, phpunit doesn't allow the pathtophp unit config setting to be set
in config.php as intended.
2018-10-30 09:15:59 +10:30
Toni Barberà Melià
c759ae5d55 MDL-60514 tasks: added new config parameter. changes in cron execution 2018-10-25 08:02:44 +02:00
Jonathan Champ
b2f349a433 MDL-54035 accesslib: separate role definition cache clear
Thanks to MDL-49398, we can separate the combined user session and role
definition cache clearing function into two separate functions. At the
same time, we want to identify and remove mark_dirty() calls that were
added for role definition changes but were incorrectly left behind.

Change highlights:
 - Remove unnecessary mark_dirty() calls performed after
   assign_capability(), unassign_capability(), delete_role(),
   deleted contexts, brand new contexts
 - Move role definition cache clear from the user-centric
   accesslib_clear_all_caches() to the newly created,
   role-dedicated accesslib_reset_role_cache()
2018-09-21 09:17:42 -04:00
David Mudrák
39d2c68856 MDL-61742 messaging: Do not send messages from inactive providers
Before this patch, we only checked that the given provider has been
configured in the user or system preferences. However, if the provider's
component is disabled, it does not even appear in these preferences.
Additionally, there was no check that the message / notification
provider is among providers allowed to be consumed by the recipient.

The patch checks that the message origin is among providers returned by
the message_get_providers_for_user() so disabled plugins can't act as
sources of messages and users can't receive messages from providers they
do not have capability for. This mitigates the risk of abusing a plugin
as a source of spam, for example.

Unit test is fixed and extended. When the $CFG->messaging is disabled,
no messages between users should be sent (I can't understand why the
unit test was written in an opposite way). Added assertions for the
raised debugging message.
2018-08-31 12:15:30 +02:00
Andrew Nicols
7bd269e82d MDL-62660 tool_dataprivacy: Add method for unit tests to run adhoc tasks 2018-08-20 15:31:20 +08:00
Adrian Greeve
5454e72c21 MDL-55188 events: First deprecation of eventslib.php 2018-07-30 09:23:54 +08:00
Michael Aherne
e99a39624e MDL-62577 unit tests: Quote class name in re-run command. 2018-05-25 16:46:45 +01:00
Mark Nelson
883ce42127 MDL-36941 core: convert existing api to use new table structure
Also deprecated the following functions -

1. message_move_userfrom_unread2read - It is not necessary
   for us to mark a message as read on user deletion.
2. message_get_blocked_users - Horrible logic used to
   determine if a user is blocked via reference on some
   randomly chosen 'isblocked' variable.
3. message_get_contacts - The same as above. This can be
   done in a much nicer way.
4. message_mark_message_read - We want two functions to do
   this to avoid confusing messages and notifications.
5. message_can_delete_message - This assumed the variable
   $message contained the 'useridto' property, which
   was present in the old table structure. We do not want
   future usages where a query is done on the new table
   and is simply passed as this won't contain this property.
6. message_delete_message - Same as above.
2018-03-23 12:30:27 +08:00
Eloy Lafuente (stronk7)
801a372dad MDL-60611 phpunit: switch to namespaced phunit classes 2017-11-02 23:45:34 +01:00
Tim Hunt
46a3753424 MDL-60139 phpunit: Make assertTag verify attribute values with ===
I had a test that cared about the difference between value="5.0" and value="5".
2017-10-30 12:52:00 +00:00
David Monllao
a272c25649 Merge branch 'MDL-60600_master' of https://github.com/marxjohnson/moodle 2017-10-26 18:33:49 +02:00
Mark Johnson
a9ca3fa167 MDL-60600 core_output: Clear static icon system cache between unit tests 2017-10-26 14:59:35 +01:00
Jake Dallimore
1e67827131 Merge branch 'MDL-60434_master' of git://github.com/dmonllao/moodle 2017-10-26 13:11:46 +08:00
David Monllao
3a89d0b541 MDL-60434 analytics: Analysables lazy loading 2017-10-25 14:16:35 +02:00
John Okely
672f483670 MDL-42834 admin: Removal of httpswwwroot 2017-10-23 12:25:36 +08:00
Eloy Lafuente (stronk7)
df4095ca6c Merge branch 'MDL-60342-master' of https://github.com/patkira/moodle 2017-10-19 23:23:49 +02:00
Jun Pataleta
a0245c6aa0 Merge branch 'MDL-60410_master' of git://github.com/dmonllao/moodle 2017-10-19 22:01:21 +13:00
Pat Kira
5a97f26be9 MDL-60342 test: Reset user agent after tests
- Add a test that proves this useragent is not being reset after a test
- Reset user agent
2017-10-18 14:03:24 +11:00
Marina Glancy
78da366b56 MDL-60281 general: various strict corrections for PHP7.2
- count() can only be called on arrays or Countable, it can not be called on null
- recordset is neither so iterator_count() should be used
- instanceof or get_class() can not be applied to non-objects
- class methods must have the same arguments as methods in parent class
2017-10-16 09:37:20 +08:00
David Monllao
c5705b3a0f MDL-60410 analytics: Whitelist pathtopython for testing 2017-10-13 13:44:47 +02:00
Ankit Agarwal
0d14fcbc60 MDL-9367 restore: Roll only configuration dates
It was decided to roll only configuration dates and any date related to user content
such as 'timecreated' , 'timemodified' etc should not be rolled forward.
2017-08-01 10:46:37 +05:30
David Monllao
2db6e9811b MDL-59212 analytics: Core indicators tests
Part of MDL-57791 epic.
2017-07-24 08:37:01 +02:00
Marina Glancy
63e9e38202 MDL-58911 calendar: use the same callbacks in unittests and prod
Remove unittest-specific callbacks for checking access and displaying
the calendar events on the dashboard.

This will allow plugin developers unittest the full behavior
of how their plugins add events to the dashboard.

Reset all static caches between unittests.
2017-06-20 16:13:35 +08:00
Eloy Lafuente (stronk7)
55946a892a MDL-54901 phpunit: Change phpunit wwwroot to HTTPS and fix tests
This includes:

- Changing PHPUnit's bootstrap to use https://www...
- Modify all existing expectations to the new wwwroot.
- Amend some tests now with different defaults because of is_https()
- Added a note to main upgrade.php about the change.
2017-04-18 03:40:17 +02:00
Andrew Nicols
1adae85448 Merge branch 'wip-mdl-58068' of https://github.com/rajeshtaneja/moodle 2017-04-10 11:54:09 +08:00
Dan Poltawski
f98ad251ae Merge branch 'MDL-55139' of git://github.com/stronk7/moodle 2017-03-28 18:33:19 +01:00
Rajesh Taneja
db4b59fa03
MDL-58068 testing: Whitelist alternative_file_system_class in testing
Unit test and behat should be allowed to
run with alternative file system
2017-02-28 14:58:49 +08:00
Rajesh Taneja
36cc9f8e37
MDL-54628 behat: Set behat dir for each run under behat_dataroot
Before this patch behat_dataroot for parallel runs
were created at same level as ->behat_dataroot
After this patch, it will be created 1 level under
->behat_dataroot with BEHAT_PARALLEL_SITE_NAME
prefix and run number as suffix. This will allow
common files as test enabled and parallel run info
to be saved in parent directory and access it easily.
2017-01-30 08:51:53 +08:00
Jake Dallimore
f6d9efefaa MDL-48498 core_files: curl_security_helper_base and implementation
Base class and core implementation providing a means to check URLs
against the curl security admin settings entries.
2016-11-08 15:11:15 +08:00
David Monllao
90abff01b3 Merge branch 'MDL-54751-master-v5' of https://github.com/snake/moodle 2016-11-07 08:55:44 +08:00
Jake Dallimore
3704ff8cde MDL-54751 phpunit: Support adhoc module and section deletion in phpunit
Created a new phpunit util function run_all_adhoc_tasks which runs any
pending tasks, for use in unit tests. Added new recyclebin and course
unit tests covering the new functionality.
2016-11-07 07:41:59 +08:00
Marina Glancy
fab11235d8 MDL-38158 core_media: Convert media players to new plugin type
AMOS BEGIN
  MOV [siteyoutube,core_media],[pluginname,media_youtube]
  MOV [siteyoutube_desc,core_media],[pluginname_help,media_youtube]
  MOV [sitevimeo,core_media],[pluginname,media_vimeo]
  MOV [sitevimeo_desc,core_media],[pluginname_help,media_vimeo]
  MOV [html5audio,core_media],[pluginname,media_html5audio]
  MOV [html5audio_desc,core_media],[pluginname_help,media_html5audio]
  MOV [html5video,core_media],[pluginname,media_html5video]
  MOV [html5video_desc,core_media],[pluginname_help,media_html5video]
  MOV [flashanimation,core_media],[pluginname,media_swf]
  MOV [flashanimation_desc,core_media],[pluginname_help,media_swf]
AMOS END
2016-11-04 17:30:40 +08:00
Amanda Doughty
cc350fd9c8 MDL-47162 core_message: Add course id to message eventdata 2016-10-27 18:11:27 +02:00
Russell Smith
ef15173794 MDL-56354 unittests: Put debug messages in the failure notice. 2016-10-26 08:39:10 +11:00
Eloy Lafuente (stronk7)
9123439e06 MDL-55139 unit tests: Make code-coverage for components way better
By specifying the filter on all those partial phpunit.xml files
we are restricting in a 99% the effort (time and memory) needed
by phpunit to process xdebug execution coverage, retricting it
to the target files within a component.
2016-10-07 00:41:22 +02:00
Rajesh Taneja
544de35bc3
MDL-55379 phpunit: Preserve config option if passed 2016-09-22 10:45:47 +08:00
Eloy Lafuente (stronk7)
0f4b338fbb Merge branch 'wip-mdl-55379' of https://github.com/rajeshtaneja/moodle 2016-09-20 02:06:32 +02:00
Russell Smith
74ee9d29d2 MDL-55944 testing: Reduce sleep usage.
Remove sleep() and replace with waiting for a second to roll over,
this results in a simpler call the guarantee time() has moved forward
2016-09-14 09:49:30 +10:00
Rajesh Taneja
1b319d3d3b
MDL-55379 phpunit: Fix dir separator for cli commands 2016-09-12 09:48:40 +08:00
Rajesh Taneja
a7f202de4e
MDL-55379 phpunit: Fixed hint_result for rerun 2016-09-12 09:48:39 +08:00
Russell Smith
8f7dcb3453 MDL-55504 profiling: Support for PHPUnit and big profiles.
To support PHPUnit we need to support large profiles, these may
include backups and restores. To do that the following was required;
- gzcompress for database space saving.
- gzcompress for XML DomDocument field to say < 10Mb and allow imports.
- Save PHPUnit runs directly to a file so they can be imported to the normal database.
- Memory allowance on profiling view pages increases to support large profiles.
2016-09-06 12:41:56 +10:00