400 Commits

Author SHA1 Message Date
Ruslan Kabalin
7d19e0e33d MDL-50887 antivirus_clamav: Move global clamav settings to plugin level.
AMOS BEGIN
 MOV [clamfailureonupload,core],[clamfailureonupload,antivirus_clamav]
 MOV [configclamactlikevirus,core],[configclamactlikevirus,antivirus_clamav]
 MOV [configclamdonothing,core],[configclamdonothing,antivirus_clamav]
 MOV [configclamfailureonupload,core],[configclamfailureonupload,antivirus_clamav]
 MOV [configpathtoclam,core],[configpathtoclam,antivirus_clamav]
 MOV [configquarantinedir,core],[configquarantinedir,antivirus_clamav]
 MOV [configrunclamavonupload,core],[configrunclamavonupload,antivirus_clamav]
 MOV [pathtoclam,core],[pathtoclam,antivirus_clamav]
 MOV [quarantinedir,core],[quarantinedir,antivirus_clamav]
 MOV [runclamavonupload,core],[runclamavonupload,antivirus_clamav]
AMOS END
2016-02-25 09:55:45 +00:00
David Monllao
db48207e1a MDL-31989 search: Search API and search engine API
Introducing both APIs in moodle along with:
- search_box widget to add a tiny search box
- admin settings with setup steps helper
- cache for search results
- template for a search result
- php unit stuff

Many thanks to Tomasz Muras, Prateek Sachan and Daniel Neis for their contributions, for starting this development
and for pushing for it to be completed. Also thanks to other contributors: Jonathan Harker and eugeneventer.
2016-02-23 10:47:58 +00:00
sam marshall
6bd871d3dd MDL-52981 Unit tests: Reset global after test 2016-02-03 10:25:27 +00:00
David Monllao
20ff2fba25 MDL-48621 events: Adapting unit tests to debugging messages
- A new assertDebuggingCalledCount has been introduced, as multiple debugging messages
  may be called in some cases, for example when calling events_cron with queued events
  that need to be dispatched.
- events_update_definition has been moved out of setUp as debugging messages are only
  caught by our phpunit custom stuff when they are called inside tests.
2016-01-19 15:19:10 +08:00
Rajesh Taneja
faea241337 MDL-52656 unittest: Reset original session while setting user 2016-01-08 09:41:28 +10:00
Andrew Nicols
46c18e0dd2 MDL-52060 phpunit: Add tests for test_set_table_modified_by_sql 2015-12-23 09:08:06 +08:00
Mark Nielsen
e61a9638f1 MDL-52060 phpunit: Improve get_message_processors reset 2015-12-22 13:40:39 +08:00
Marina Glancy
1766e6a17f MDL-52284 core: PHP7 engine errors have type Throwable 2015-12-10 10:49:37 +08:00
Tony Levi
d74b7e424f MDL-52284 core: compatibility with Exception/Throwable changes in PHP7 2015-12-10 10:49:36 +08:00
David Monllao
53f8e45279 Merge branch 'MDL-50687-master' of git://github.com/danpoltawski/moodle 2015-11-16 14:25:48 +08:00
Dan Poltawski
9680529069 MDL-50687 phpunit: error early if required locale not installed 2015-11-13 07:00:09 +00:00
Rajesh Taneja
81676e84e6 MDL-52077 unittest: Fixed string typo 2015-11-10 13:53:47 +08:00
David Mudrák
3bca7dbfa6 MDL-49329 admin: Get rid of mdeploy and \core\update\deployer class
The mdeploy.php standalone script (used to download and unzip plugins
into the dirroot) and the \core\update\deployer class (as a
communication bridge between the core and the mdeploy.php) was
originally designed and implemented with the assumption that it would be
eventually used for updating the Moodle core itself, too. Therefore it
was written as standalone utility without dependency on the Moodle core
libraries.

However, it never happened and there is no real demand for that. So now
there is no need to have and maintain a completely parallel solution for
common things like fetching and unzipping plugin ZIPs.

Additional reasoning for mdeploy.php was that the core is not very
reliable during the core upgrade and we could run into various troubles.
This does not seem to be that bad. We rely on a lot of core
functionality (such as output rendering, DB access etc) and plugins
deployment seems to work well (and better) with common core libraries.

So long mdeploy, and thanks for all the hard work you did for us.
2015-10-08 23:32:04 +02:00
rajesh Taneja
5ecf8e8f21 MDL-51266 unittest: replaced low level phpunit_util calls 2015-09-23 15:42:48 +08:00
Andrew Nicols
4463f996c4 MDL-51236 phpunit: Prevent testsuite name conflicts
The testsuite name is fed straight into a class_exists() in
PHPUnit_Framework_TestSuite. In some cases, e.g. cachestore_static, the
class does exist, it's then fed into a ReflectionClass, and the test fails.

The testsuite needs to not conflict with any classes which could be
autoloaded in Moodle core.
2015-08-28 14:22:07 +08:00
Eloy Lafuente (stronk7)
839b8c3905 Merge branch 'MDL-47449-master' of git://github.com/andrewnicols/moodle 2015-08-19 18:30:33 +02:00
Dan Poltawski
b1da1e289b Merge branch 'MDL-49841-master' of git://github.com/andrewnicols/moodle 2015-08-19 18:30:31 +02:00
sam marshall
89a73b0815 MDL-51077 Availability: Date restriction unit test static not cleared 2015-08-14 10:51:29 +01:00
Andrew Nicols
504c97925c MDL-47449 phpunit: Add comparitor for isEqual with exceptions
We often do isEqual tests but where a field, may have a single exception.
Ordinarily we can handle this easily by breaking the test down, but when
dealing with mocked objects we can only pass an instance of a
PHPUnit_Framework_Constraint, or a single value (which is cast to an
instance of PHPUnit_Framework_Constraint_IsEqual).

To deal with instances of time-based exception, we need to be able to
compare simple objects and classes where one or two values may be
different.
2015-08-14 10:53:19 +08:00
Andrew Nicols
d78613701c MDL-49841 testing: Correct composer incantation 2015-08-14 10:27:53 +08:00
David Monllao
ede96605ac Merge branch 'MDL-51053-master' of git://github.com/sammarshallou/moodle 2015-08-12 08:23:29 +08:00
sam marshall
27479b5cc9 MDL-51053 Restore: Static cache breaks unit tests 2015-08-11 14:07:38 +01:00
Rajesh Taneja
b9432e1a7d MDL-50926 phpunit: Advanced testcase should extend base_testcase 2015-08-11 02:37:28 +02:00
Tony Levi
b80b35d0fc MDL-50926 phpunit: Upgrade to phpunit 4.x 2015-08-11 02:35:11 +02:00
Petr Skoda
d6e7a63d9a MDL-49684 timezones: rewrite timezone support
This patch replaces all homegrown timezone
stuff with standard PHP date/time code.

The main change is the introduction of core_date
class that returns normalised user and server
timezones. From now on nobody should be using
$CFG->timezone or $user->timezone directly!

Other new features and fixes:
* admins are prompted for timezone during install
* editing of other users is finally fixed
* timezones are displayed in user profile
* new $this->setTimezone() in phpunit
* time locale is now automatically reset in phpunit
* timezone is now automatically reset in phpunit
* phpunit has Australia/Perth as default timezone
2015-04-06 13:53:51 +12:00
sam marshall
91fed57a4e MDL-42616 filelib: Use config value for custom MIME types (1/2)
Uses a new optional config variable to define custom MIME types
in JSON format. Includes new API for accessing and modifying
this data.
2014-12-19 14:48:59 +00:00
Andrew Nicols
fc05c1b8e5 MDL-48197 testing: Normalise uses of noemailever and phpmailer sink 2014-11-19 09:09:50 +08:00
Andrew Nicols
556e3a9e8a MDL-48197 testing: Always set up a mail sink for mail redirection
Rather than setting noemailever in the bootstrap, this sets up a default
phpmailer message sink which will catch all messages.

Tests which require the phpmailer sink will continue to work as before
without change, though the noemailever config setting no longer needs to
be altered.

For tests wanting to test with noemailever set with the previous behaviour,
they will need to load the message sink and then close it.
2014-11-19 09:09:49 +08:00
Sam Hemelryk
d6abe6f744 Merge branch 'MDL-48194-master' of git://github.com/andrewnicols/moodle 2014-11-17 13:39:03 +13:00
Andrew Nicols
14ecbb2ee8 MDL-48196 phpunit: Set e-mail address for admin user at installation 2014-11-13 08:47:43 +08:00
Andrew Nicols
a9edd8a671 MDL-48194 testing: Adjust naming of testsuites in phpunit.xml
This will make it easier to run phpunit for a specific component by making
all testsuite names consistent, guessable, and in-line with the naming of
the parameter (testsuite vs. test suite).
2014-11-12 11:46:03 +08:00
Petr Skoda
1993cc02b6 MDL-47287 prevent web access to phpunit boostrap 2014-11-03 17:10:33 +08:00
Petr Skoda
ddffa9d6d3 MDL-47538 phpunit: fix invalid PHPUNIT_SEQUENCE_START constant 2014-10-06 17:31:15 +13:00
Russell Smith
9462323b13 MDL-46193 phpunit: Replace value in component config.
There are two phpunit.xml build locations, one for overall
and another for individual components.  To reduce id changes
when running different components, we use the same initial ID
in all component files when building.
2014-07-10 09:53:23 +02:00
Russell Smith
529495f7ce MDL-46193 phpunit: Use random starting value on initialization. 2014-07-04 16:33:13 +10:00
Petr Skoda
2e00d01db4 MDL-46099 session: fix use of references for session globals
This reverses the references used for global $USER and $SESSION,
the reason is that PHP does not allow references to references.
$USER is a reference to $GLOBALS['USER'] which means we cannot
put any references to it. Solution is to store the current user and session
objects in $GLOBALS['USER'] and $GLOBALS['SESSIOn'] are reference
them in $_SESSION.

This patch makes the session code behave the same way in CLI,
phpunit and normal web requests - this allows use to finally
unit test most aspects of the session code in Moodle.
2014-07-01 08:38:00 +12:00
Russell Smith
d2c58b95bb MDL-43835 phpunit: Correct unit tests.
When different ID's are set for each sequence a number
of unit test failures appear.  They have been corrected
to allow unit tests to pass with the new generator in place.
2014-06-17 19:08:01 +10:00
Marina Glancy
0313897108 Merge branch 'wip-mdl-44839' of git://github.com/rajeshtaneja/moodle
Conflicts:
	lib/phpunit/bootstrap.php
2014-06-04 10:07:03 +08:00
Rajesh Taneja
1bce3a70d9 MDL-44839 admin: Moved all system executable paths to config
AMOS BEGIN
 MOV ['gspath','assignfeedback_editpdf'],['pathtogs','admin']
 MOV ['gspath_help','assignfeedback_editpdf'],['pathtogs_help','admin']
AMOS END
2014-06-03 17:33:49 +08:00
Sam Hemelryk
79a8ea653c MDL-45513 cache: added support to unit tests for alt cache stores 2014-05-30 08:41:07 +12:00
Rajesh Taneja
6b8e46ad04 MDL-45565 core_message: Reset internal users in phpunit 2014-05-26 15:42:12 +08:00
Damyon Wiese
84f08cfa9d MDL-45606 Unit test fix for MySQL and added a comment about the removed code. 2014-05-20 18:01:32 +08:00
Damyon Wiese
726b011050 MDL-45605 Phpunit: Do not call gc_collect_cycles as part of reset.
This takes 25% of the time in running tests and there is no benefit. The
behaviour of destructors is the same before/after the patch.
2014-05-19 10:37:16 +08:00
Petr Skoda
a9236a2c3f MDL-45287 fix behat database reset between scenarios
We cannot find out if DB received any writes because behat
web access runs in different request.

This was affecting only scenarios without generators.
2014-04-28 17:02:58 +08:00
Juan Leyva
5e12b369af MDL-44954 messages: Fixed save notifications with the notification flag 2014-04-07 12:19:52 +02:00
Petr Škoda
08ec831ff8 MDL-44510 fix class guessing in phpunit 4 2014-03-26 11:32:33 +08:00
Petr Škoda
54f1423ecc MDL-44510 support PHPUnit 4.x
The old style PEAR installation is incompatible with PHPUnit 4,
nobody was supposed to use PEAR any more - composer
is the only supported library installation method now.
2014-03-20 17:30:42 +08:00
Petr Škoda
c386f35bca MDL-44339 treat unexpected debugging() calls in phpunit tests as errors 2014-03-14 11:43:46 +08:00
Eloy Lafuente (stronk7)
630bb85d9e MDL-43266 testing: avoid assoc arrays for json
Last commit switched from raw arrays to associative
arrays. That leads to json_encode() to generate an
object instead of an array, ultimately leading to
problems with the rest of code expecting an array.

By using array_values() we are moving back to the
non-associative array.

Also, fix some file permissions.
2014-03-13 22:11:03 +01:00
Eloy Lafuente (stronk7)
1700bec3c6 Merge branch 'MDL-43266_master-last-fixes' of git://github.com/dmonllao/moodle
Conflicts:
	lib/phpunit/classes/util.php
2014-03-13 19:12:25 +01:00