Common unit test problems: Difference between revisions
(General formatting and tidy up) |
mNo edit summary |
||
Line 79: | Line 79: | ||
<code>text size = 20971520</code> | <code>text size = 20971520</code> | ||
< | <code>client charset = UTF8</code> | ||
=== PHP Warning: include_once(PHPUnit/Extensions/Database/Autoload.php): failed to open stream === | === PHP Warning: include_once(PHPUnit/Extensions/Database/Autoload.php): failed to open stream === |
Revision as of 12:27, 29 November 2013
General Issues
Unit tests are taking more than 10 mins to run
This problem is under investigation. We are hoping to find the soluton. On a typical system all tests complete in under 6 mins.--Dan Poltawski 12:43, 15 May 2012 (WST)
You maybe find much better performance on psql as a workaround for now if not doing DB dependent tests.
If using linux on an EXT4 file system, disabling barriers by adding barrier=0 to the end of the options in /etc/fstab for the drive should offer HUGE speed improvements. Note that this is very dangerous for system stability and in the event of a power failure can cause permanent and irrecoverable data loss.
Segfaults on Oracle
When I was running tests on oracle I was getting phpunit sefaulting.. --Dan Poltawski 00:29, 16 May 2012 (WST)
Solution Set statement_cache_size in php.ini: oci8.statement_cache_size = 0
Specific failures
dml_testcase::test_unique_index_collation_trouble
Unique index is accent insensitive, this may cause problems for non-ascii languages. This is usually caused by accent insensitive default collation.
Solution This is expected to fail if you are running MySQL. These tests should pass if you use the utf8_bin
collation on your database for unit tests, but we recommend utf8_unicode_ci
for actual live Moodle sites. Work is being done to resolve this issue, read more about the Database collation issue for further info.
dml_testcase::test_sql_binary_equal
SQL operator "=" is expected to be case sensitive Failed asserting that 1 matches expected 2.
Solution This is expected to fail if you are running MySQL. These tests should pass if you use the utf8_bin
collation on your database for unit tests, but we recommend utf8_unicode_ci
for actual live Moodle sites. Work is being done to resolve this issue, read more about the Database collation issue for further info.
grading_manager_testcase::test_tokenize
A test using UTF-8 characters has failed. Consider updating PHP and PHP's PCRE or INTL extensions (MDL-30494) Failed asserting that false is true.
Solution This is expected to fail if you are running MySQL. These tests should pass if you use the utf8_bin
collation on your database for unit tests, but we recommend utf8_unicode_ci
for actual live Moodle sites. Work is being done to resolve this issue, read more about the Database collation issue for further info.
moodlesimplepie_testcase::test_getfeed
Failed to load the sample RSS file. Please check your proxy settings in Moodle. %s
Solution Your moodle needs network connectivity, please check proxy settings.
moodlesimplepie_testcase::test_redirect
Failed asserting that 'cURL Error: Operation timed out after 2000 milliseconds with 0 bytes received' is null.
Solution Your moodle needs network connectivity, please check proxy settings
collatorlib_testcase::test_asort_objects_by_method
Collation aware sorting not supported, PHP extension "intl" is not available.
Solution Install php intl extension.
Note that, on Windows, this extension does not seem to be included in the installer, but you can get it by downloading the zip, and copying the right DLLs across. If you Google, there are more detailed instructions on Stack Exchange.
moodlelib_testcase::test_fix_utf8
Failed asserting that false is identical to 'aaabbb'.
Solution This problem indicates buggy iconv. See [1] for discussion. So this is a real problem, to be fixed in a future integration cycle
filestoragelib_testcase::test_get_file_preview
Failed asserting that false is an instance of class "stored_file".
Solution Unfortunately, the php GD extension is a requirement for this test (see MDL-36447).
Go to your Moodle directory and type php admin/tool/phpunit/cli/util.php --drop
, then reinitialise PHPunit and run the test again.
MSSQL failures with core_course_externallib_testcase
On the MSSQL database driver, some problems occur with core_course_externallib_testcase, for example:
core_course_externallib_testcase::test_duplicate_course
unserialize(): Error at offset 24191 of 24192 bytes
Solution Ensure that the correct configuration is set in freedts.conf (from https://docs.moodle.org/26/en/FreeTDS), e.g.
text size = 20971520
client charset = UTF8
PHP Warning: include_once(PHPUnit/Extensions/Database/Autoload.php): failed to open stream
This occurs on Mac installs from experience. The reason this occurs is because DBUnit was not installed during the PHPUnit installation via PEAR.
Solution In terminal type: sudo pear install -f phpunit/DbUnit
!!! Error reading from database !!!!! Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.
If running unit tests under FreeTDS, remember that without a valid FREETDS environment variable, PHP won't be able to find the freetds.conf file and will default to version 5.0 which has poor support for unicode collations.
Solution Ensure a FREETDS environment variable is set prior to running the automated tests, which points to a valid path that contains a freetds.conf file. Also ensure the tds version element is set to a recent enough version (8.0)
Note: Another potential solution may be to set TDSVER (http://freetds.schemamania.org/userguide/freetdsconf.htm)