60 Commits

Author SHA1 Message Date
Matt Porritt
aa11164e07 MDL-78893 Libaries: explicity set $flags for htmlspecialchars function
As part of PHP 8.2 compatibility explicitly set the flags for the
htmlspecialchars function, to convert both single and double quotes.
2023-08-03 14:33:34 +10:00
Stephan Robotta
95f5e32f99 MDL-63759 iplookup: use OSM if Google is not used, use accuracy radius 2023-05-24 08:40:34 +02:00
Paul Holden
7f59718891 MDL-77040 core: assert types of returned Geoplugin data, not values.
The results we get from these tests are beyond our control, and are
unreliable for use in testing.

See also previous change 215cd2d8 in similar tests.
2023-01-26 13:24:00 +00:00
Simey Lameze
6510a7d9ba MDL-77036 core_iplookup: update test_ipv4 test expectations 2023-01-25 15:11:52 +08:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Eloy Lafuente (stronk7)
caf55abf17 MDL-74413 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:

- Moved to the level2 "privacy" namespace:
  - \mod_assign\privacy\feedback_legacy_polyfill_test
  - \mod_assign\privacy\submission_legacy_polyfill_test

- Moved to the level2 "task" namespace:
  - \core_message\task\migrate_message_data_test
  - \ltiservice_gradebookservices\task\cleanup_test
  - \message_email\task\send_email_test
  - \mod_lti\task\clean_access_tokens_test
  - \mod_workshop\task\cron_task_test

- Moved to the level2 "event" namespace:
  - \core_h5p\event\deleted_test
  - \core_h5p\event\viewed_test

- Renamed to a better name:
  - backup_forum_activity_task_test.php (missing "task")
2022-05-07 20:32:30 +02:00
Marina Glancy
5ac66934f4 MDL-70584 core_iplookup: increase tolerance in test 2021-01-07 14:12:59 +01:00
Eloy Lafuente (stronk7)
3a5641cb74 MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals()
are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):

- delta => use assertEqualsWithDelta()
- canonicalize => use assertEqualsCanonicalizing()
- ignoreCase => use assertEqualsIgnoringCase
- maxDepth => removed without replacement.

More info @ https://github.com/sebastianbergmann/phpunit/issues/3341

Initial search done with:

ag 'assert(Not)?Equals\(.*,.*,' --php

Then, running tests and fixing remaining cases.
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
f94195c320 MDL-67673 phpunit: Remove deprecated assertInternalType()
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

assertInternalType() is deprecated and will be removed in
PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(),
assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(),
assertIsResource(), assertIsString(), assertIsScalar(),
assertIsCallable(), or assertIsIterable() instead.
2020-10-21 12:45:59 +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
Jake Dallimore
b145fe216c MDL-67593 core_iplookup: use MaxMind test database in unit tests
Instead of downloading a live database (now not available publicly)
use a local test database.
2019-12-31 15:01:51 +08:00
Eloy Lafuente (stronk7)
f71c8d96bd MDL-61169 iplookup: Change to another block still remaining to SF 2018-09-13 19:01:09 +02:00
Eloy Lafuente (stronk7)
83c64f78c0 Merge branch 'MDL-36941_master-fix' of git://github.com/markn86/moodle 2018-03-28 18:42:18 +02:00
Andrew Nicols
215cd2d854 MDL-61770 iplookup: Check types rather than values 2018-03-28 10:54:10 +08:00
Andrew Nicols
2cf6b060cd MDL-61169 iplookup: Change to github.com IP 2018-01-08 17:15:12 +08:00
Dan Poltawski
2fe28e0dc3 MDL-56740 geoip tests: update to a more reliable ipv6 location
Hopefully. It's quite difficult for us to test this funcionality with
altering data sets. Hoping this UCLA v6 address will be more reliable.
2016-11-04 08:52:40 +00:00
Dan Poltawski
a4a815f31c MDL-56331 tests: update with current coordinates
The previous commit will minor updates to pass, but this updates
to current values.
2016-10-10 09:10:07 +01:00
Dan Poltawski
0b73876317 MDL-56331 tests: increase tolerance of coordinate tests
1) It seems the maxmind database is getting relatively frequent updates
which are causing differences in exact coordinates

2) GeoIP location lookups are not an exact science, I tried to pick some
ips which I thought would remain fairly static, but these things are
just guesses.

3) Moving to 2 decimal places should give us good enough results for
this test, according to:
http://gis.stackexchange.com/questions/8650/measuring-accuracy-of-latitude-and-longitude

  "The second decimal place is worth up to 1.1 km: it can separate one
   village from the next."
  "The third decimal place is worth up to 110 m: it can identify a
   large agricultural field or institutional campus."
2016-10-10 09:07:38 +01:00
Dan Poltawski
c307689792 MDL-48766 tests: move from Liberec to Cambridge
(liberec ip seemed to have been identified as a new location nearby now,
hoping cambridge will be stable)
2016-09-19 08:59:39 +01:00
Dan Poltawski
3fad0f1a24 MDL-48766 iplookup: Update to geoip2 db to support ipv6
The previous maxmind geoip database is now legacy and the GeoIP2
version supports ipv6.
2016-09-19 08:59:39 +01:00
Frederic Massart
eb46bf2f4e MDL-47321 iplookup: Prevent guest users from using iplookup 2014-11-04 10:01:43 +13:00
Tony Butler
1e31f11852 MDL-28484 core_lib: Add function for https detection
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-10-03 13:02:29 +01:00
Petr Škoda
2f1e464a88 MDL-40438 migrate all collatorlib:: and textlib:: uses 2013-08-06 21:04:35 +02:00
Petr Škoda
8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Petr Škoda
704533fca7 MDL-34960 drop deprecated Google Maps API V2 2012-08-19 20:07:27 +02:00
Petr Škoda
cec7d43591 MDL-34959 add Google Maps API V3 support 2012-08-19 19:52:35 +02:00
Ankit Agarwal
bf0f06b1be MDL-34471 libraries: Replace all uses of get_context_instance() with respective context_XXXX::instance() method 2012-08-02 15:37:38 +08:00
Petr Skoda
64b0f3ab68 MDL-32868 fix iplookup inconsistencies and add missing unit tests
Please note you need to define PHPUNIT_LONGTEST in config.php or phpunit.xml to get the tests to execute because it takes long time to fetch the geoip data and we do not want to DDOS geoPlugin server.
2012-05-12 14:25:01 +02:00
Petr Skoda
8c6136a879 MDL-32793 use geoLookup for IP address lookup by default 2012-05-08 23:45:28 +02:00
Petr Skoda
f8311defeb MDL-31301 use static textlib methods 2012-03-03 11:46:13 +01:00
Petr Skoda
4bc737d175 fixed docs 2010-09-17 19:31:10 +00:00
Petr Skoda
85ba38ef4f fixed unterminated JS statement 2010-09-17 19:30:26 +00:00
Petr Skoda
b9ee1fc748 MDL-23720 improved iplookup coding style + fixed a potential privacy issue 2010-08-09 16:10:02 +00:00
Petr Skoda
8061887a68 MDL-23720 fixed unicode issue in geoip results 2010-08-09 13:21:13 +00:00
Petr Skoda
bbb13f0619 MDL-23720 importing latest PEAR GeoIP module 2010-08-09 13:10:33 +00:00
Petr Skoda
8fb1c9af08 MDL-23695 fixed yet another PAGE->context issue 2010-08-09 08:21:45 +00:00
Petr Skoda
0aa759b01c MDL-22015 more get_list_of_countries() refactoring 2010-04-14 14:27:10 +00:00
Petr Skoda
789ff38c47 MDL-21400 converted iplookup to YUI3, removed in_head() 2010-02-06 12:12:23 +00:00
Petr Skoda
a685593466 MDL-21233 moodle_url improvemewnts, code simplification, more diagnostics; fixed several regressions 2010-01-16 15:39:56 +00:00
Petr Skoda
f44b10ed93 MDL-21139 replace all yui functions/methods with yui2 to make room for yui3 2009-12-16 20:25:14 +00:00
Petr Skoda
78946b9bdb MDL-20204 first batch of major theme changes, some regressions are still there, expect more changes and improvements soon; see tracker for details and list of subtasks 2009-12-16 18:00:58 +00:00
Petr Skoda
6f5e085205 MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup 2009-11-01 16:48:45 +00:00
Petr Skoda
49ab5e1950 MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup 2009-11-01 15:32:33 +00:00
skodak
4aa31a61f0 MDL-19875 tested patch and added some more echos, thanks Tim! 2009-07-21 08:19:02 +00:00
Moodle HQ git importer
75c7b84f16 Fixing drift between CVS and git 2009-07-20 03:04:08 +00:00
skodak
536ec7edaf MDL-19874 updated geoip to 1.80 and fixed iplookup regressions 2009-07-19 13:55:03 +00:00
skodak
c1d1e93bce MDL-19874 updated geoip to 1.80 and fixed iplookup regressions 2009-07-19 13:54:12 +00:00
skodak
48fb4cd689 MDL-19874 updated geoip to 1.80 and fixed iplookup regressions 2009-07-19 13:54:11 +00:00
fmarier
316914bf6e MDL-17037 ran all GIF images through gifsicle and PNG through optipng 2009-04-05 23:33:00 +00:00
skodak
ab122f4604 MDL-14679 2008-05-31 17:48:51 +00:00