1. getMock()
2. setExpectedException()
3. checkForUnintentionallyCoveredCode renamed to beStrictAboutCoversAnnotation
4. beStrictAboutTestSize renamed to enforceTimeLimit
5. UnitTestCase class is now fully removed.
This lets us convert between common office formats. E.g. docx -> pdf
html -> pdf, html -> ods.
This commit also updates assignment editpdf plugin to use this converter
on all compatible submission files.
Also the get_property_definition() was created to get the property without retrieve the whole definition cache and
unit tests were created to tests those new methods.
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.
- 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.
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.
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.
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.
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
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.
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).
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.
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.
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.
AMOS BEGIN
MOV ['gspath','assignfeedback_editpdf'],['pathtogs','admin']
MOV ['gspath_help','assignfeedback_editpdf'],['pathtogs_help','admin']
AMOS END