Commit Graph

34 Commits

Author SHA1 Message Date
Russell Smith 9eb3fb41c3 MDL-56354 unittests: Put debug messages in the failure notice. 2016-10-26 09:24:37 +11:00
Russell Smith e4439947ac 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:50:32 +10: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
rajesh Taneja 5ecf8e8f21 MDL-51266 unittest: replaced low level phpunit_util calls 2015-09-23 15:42:48 +08: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
Andrew Nicols fc05c1b8e5 MDL-48197 testing: Normalise uses of noemailever and phpmailer sink 2014-11-19 09:09:50 +08: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
Juan Leyva 5e12b369af MDL-44954 messages: Fixed save notifications with the notification flag 2014-04-07 12:19:52 +02:00
Petr Škoda 2a67e105b6 MDL-41935 attempt to work around random time comparison test failures 2013-10-12 15:53:25 +02:00
Sam Hemelryk 52dc898d16 Merge branch 'MDL-41228_master' of https://github.com/totara/openbadges 2013-10-01 13:37:44 +13:00
Petr Škoda d79d5ac276 MDL-31501 rework user session architecture
List of changes:
 * New OOP API using PHP namespace \core\session\.
 * All handlers now update the sessions table consistently.
 * Experimental DB session support in Oracle.
 * Full support for session file handler (filesystem locking required).
 * New option for alternative session directory.
 * Official memcached session handler support.
 * Workaround for memcached version with non-functional gc.
 * Improved security - forced session id regeneration.
 * Improved compatibility with recent PHP releases.
 * Fixed borked CSS during install in debug mode.
 * Switched to file based sessions in new installs.
 * DB session setting disappears if DB does not support sessions.
 * DB session setting disappears if session handler specified in config.php.
 * Fast purging of sessions used in request only.
 * No legacy distinction -  file, database and memcached support the same functionality.
 * Session handler name included in performance info.
 * Fixed user_loggedin and user_loggedout event triggering.
 * Other minor bugfixing and improvements.
 * Fixed database session segfault if MUC disposed before $DB.

Limitations:
 * Session access time is now updated right after session start.
 * Support for $CFG->sessionlockloggedinonly was removed.
 * First request does not update userid in sessions table.
 * The timeouts may break badly if server hosting forces PHP.ini session settings.
 * The session GC is a lot slower, we do not rely on external session timeouts.
 * There cannot be any hooks triggered at the session write time.
 * File and memcached handlers do not support session lock acquire timeouts.
 * Some low level PHP session functions can not be used directly in Moodle code.
2013-09-21 13:11:56 +02:00
Yuliya Bozhko ed23ad31c7 MDL-41228 phpunit: Reset message processors list in unit tests 2013-09-03 17:43:53 +12:00
Petr Škoda f52f2c9597 MDL-41022 cleanup core_phpunit_basic_testcase 2013-08-24 16:18:19 +02:00
Petr Škoda 3405d82c91 MDL-41022 cleanup core_phpunit_advanced_testcase 2013-08-24 16:18:19 +02:00
Petr Škoda 96f81ea385 MDL-39474 introduce $CFG->debugdeveloper and cleanup $CFG init 2013-08-12 13:01:47 +02:00
Jamie Pratt 596ea56f6b MDL-40388 Reset globals after each unit test 2013-07-09 12:26:28 +08:00
Petr Škoda 774d1d2429 MDL-37780 make sure there are no windows line endings in test files 2013-01-30 21:23:29 +01:00
Eloy Lafuente (stronk7) fa669c49ad Merge branch 'w03_MDL-36411_m25_setup' of git://github.com/skodak/moodle 2013-01-21 20:08:12 +01:00
Petr Škoda 6a8e467916 MDL-36411 make sure asserts in setUp() do not cause problems 2013-01-19 13:19:49 +01:00
David Monllao 5c3c2c81be MDL-37457 testing Refactoring references 2013-01-15 11:07:43 +08:00
Dan Poltawski 1b01909597 Merge branch 'w47_MDL-36547_m24_sectiongen' of git://github.com/skodak/moodle 2012-11-21 15:26:15 +08:00
Petr Škoda 4f5789eae8 MDL-36703 very basic support for enrolments in data generator 2012-11-19 23:15:29 +01:00
Petr Škoda b4126b0c8b MDL-36547 add test for section number when generating modules 2012-11-17 09:05:29 +01:00
Dan Poltawski 348be850c9 Merge branch 'w42_MDL-35854_m24_usergenerator' of git://github.com/skodak/moodle 2012-10-15 16:03:53 +08:00
Petr Škoda 4c9e03f0ac MDL-36031 implement message redirection for unit testing 2012-10-13 20:00:54 +02:00
Petr Škoda fe67134eaa MDL-35854 fix username generator
This eliminates infinite loop and also fixes potentially invalid email derived from usernames created from unicode first/last name.
2012-10-13 09:57:35 +02:00
Eloy Lafuente (stronk7) 5ceded2869 Merge branch 'w38_MDL-35465_m24_cohortscleanup' of git://github.com/skodak/moodle 2012-09-18 16:55:42 +02:00
Petr Škoda ef5b5e051e MDL-35479 debugging support in our phpunit integration 2012-09-17 11:27:57 +02:00
Petr Škoda 4729332b15 MDL-35465 add basic cohort lib tests and generator 2012-09-16 20:23:19 +02:00
Petr Škoda 4a38e65977 MDL-34912 fix invalid descriptionformat default handling 2012-08-18 09:52:31 +02:00
Petr Skoda d59ef9c5ab MDL-32926 exorcise setUser(2) evil from phpunit 2012-05-12 21:42:07 +02:00
Petr Skoda 08ad325702 MDL-32960 put phpunit integration tests to one test suite and execute them first 2012-05-12 21:33:23 +02:00