Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Unit tests
    • Labels:

      Description

      Done:

      • completionlib
      • new exit code constants
      • improved diagnostic message for missing DbUnit extension
      • remove @ silencing from diagnostic includes
      • fixed paths in windows phpunit configuration files
      • improved module generators - triggering gradebook and events changes now

      todo:

      • hide simpletest UI
      • delete all converted simpletests
      • webservices - it must be completely redesigned to not rely on HTTP

      notes:

      • I have decided to remove the init.sh and init.bat and keep only init.php, this should simplify maintenance and prevent bugs

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Eloy Lafuente (stronk7) added a comment - - edited

            Found some problems after trying the phpunit tests, it seems we must (after discussing it with Petr):

            1) make get_tables() to return some details, like "->temp = true|false"
            2) based on those details, use drop_table() or drop_temp_table() in reset_database()
            3) each time that there are tables dropped, inform about it, because each testcase should be responsible of self-dropping custom stuff (no matter if reset_database() does it for you.
            4) add DB functional tests about 1) and 2)

            Investigation continues...

            Show
            Eloy Lafuente (stronk7) added a comment - - edited Found some problems after trying the phpunit tests, it seems we must (after discussing it with Petr): 1) make get_tables() to return some details, like "->temp = true|false" 2) based on those details, use drop_table() or drop_temp_table() in reset_database() 3) each time that there are tables dropped, inform about it, because each testcase should be responsible of self-dropping custom stuff (no matter if reset_database() does it for you. 4) add DB functional tests about 1) and 2) Investigation continues...
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Just spent some time creating one new option to cli/util.php (--builconfigdist) to create distributed phpunit.xml files one every plugin/susbsystem/directory candidate to have them.

            Useful for cli/ci/ide execution... for your consideration. Feel free to pick the commit (and amend the msg, surely).

            https://github.com/stronk7/moodle/compare/master...buildconfig_spread

            Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - Just spent some time creating one new option to cli/util.php (--builconfigdist) to create distributed phpunit.xml files one every plugin/susbsystem/directory candidate to have them. Useful for cli/ci/ide execution... for your consideration. Feel free to pick the commit (and amend the msg, surely). https://github.com/stronk7/moodle/compare/master...buildconfig_spread Ciao
            Hide
            Eloy Lafuente (stronk7) added a comment -

            One more thing: "phpunit" needs to be declared as proper category @ http://docs.moodle.org/dev/Core_APIs.

            Or we need to use "test" that is the official name right now.

            Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - One more thing: "phpunit" needs to be declared as proper category @ http://docs.moodle.org/dev/Core_APIs . Or we need to use "test" that is the official name right now. Ciao
            Hide
            Petr Skoda added a comment -

            thanks Eloy for the patch - I will review/test it this week after integration, I will have a look at the phpdocs issue too - phpunit stage 5

            Show
            Petr Skoda added a comment - thanks Eloy for the patch - I will review/test it this week after integration, I will have a look at the phpdocs issue too - phpunit stage 5
            Hide
            Dan Poltawski added a comment -

            Thanks Petr, this has been integrated now

            Show
            Dan Poltawski added a comment - Thanks Petr, this has been integrated now
            Hide
            Michael de Raadt added a comment -

            I'll test this with Oracle shortly.

            Show
            Michael de Raadt added a comment - I'll test this with Oracle shortly.
            Hide
            Rajesh Taneja added a comment -

            PhpUnit ran fine, but following failed (not related)
            One failure on Postgres, but when ran second time no error appear.

             
            1) courselib_testcase::test_reorder_sections
            Failed asserting that 13 matches expected '6'.
            /var/www/test/course/tests/courselib_test.php:47
            /var/www/test/lib/phpunit/lib.php:1124
            

            MSSQL

            There were 4 errors:
             
            1) dml_testcase::test_get_records_sql
            mssql_data_seek(): Bad row offset
             
            /var/www/test/lib/dml/mssql_native_moodle_database.php:720
            /var/www/test/lib/dml/mssql_native_moodle_database.php:747
            /var/www/test/lib/dml/tests/dml_test.php:1428
             
            2) dml_testcase::test_concurent_transactions
            dml_read_exception: Error reading from database (
            SELECT COUNT('x') FROM t_test_table 
            [array (
            )])
             
            /var/www/test/lib/dml/moodle_database.php:413
            /var/www/test/lib/dml/mssql_native_moodle_database.php:260
            /var/www/test/lib/dml/mssql_native_moodle_database.php:717
            /var/www/test/lib/dml/mssql_native_moodle_database.php:747
            /var/www/test/lib/dml/moodle_database.php:1341
            /var/www/test/lib/dml/moodle_database.php:1414
            /var/www/test/lib/dml/moodle_database.php:1586
            /var/www/test/lib/dml/moodle_database.php:1569
            /var/www/test/lib/dml/moodle_database.php:1552
            /var/www/test/lib/dml/tests/dml_test.php:4249
             
            3) dml_testcase::test_limits_and_offsets
            mssql_data_seek(): Bad row offset
             
            /var/www/test/lib/dml/mssql_native_moodle_database.php:720
            /var/www/test/lib/dml/mssql_native_moodle_database.php:747
            /var/www/test/lib/dml/tests/dml_test.php:4446
            

            Oracle
            Segmentation fault (core dumped), I tried running functional db test, but it gave "exit signal Segmentation fault". Seems to be problem with my oracle db setup. Have requested Michael to test this and will pass this after he put his comments

            UTF8 error/failure on all db's. But they seems to be related to my installation so ignoring them.

            4) moodlelib_testcase::test_fix_utf8
            iconv(): Detected an illegal character in input string
             
            /var/www/test/lib/moodlelib.php:1130
            /var/www/test/lib/tests/moodlelib_test.php:315
            /var/www/test/lib/phpunit/lib.php:1124
            There was 1 failure:
            1) dml_testcase::test_sql_binary_equal
            SQL operator "=" is expected to be case sensitive
            Failed asserting that 1 matches expected 2.
             
            /var/www/test/lib/dml/tests/dml_test.php:3456
            

            Show
            Rajesh Taneja added a comment - PhpUnit ran fine, but following failed (not related) One failure on Postgres , but when ran second time no error appear. 1) courselib_testcase::test_reorder_sections Failed asserting that 13 matches expected '6'. /var/www/test/course/tests/courselib_test.php:47 /var/www/test/lib/phpunit/lib.php:1124 MSSQL There were 4 errors:   1) dml_testcase::test_get_records_sql mssql_data_seek(): Bad row offset   /var/www/test/lib/dml/mssql_native_moodle_database.php:720 /var/www/test/lib/dml/mssql_native_moodle_database.php:747 /var/www/test/lib/dml/tests/dml_test.php:1428   2) dml_testcase::test_concurent_transactions dml_read_exception: Error reading from database ( SELECT COUNT('x') FROM t_test_table [array ( )])   /var/www/test/lib/dml/moodle_database.php:413 /var/www/test/lib/dml/mssql_native_moodle_database.php:260 /var/www/test/lib/dml/mssql_native_moodle_database.php:717 /var/www/test/lib/dml/mssql_native_moodle_database.php:747 /var/www/test/lib/dml/moodle_database.php:1341 /var/www/test/lib/dml/moodle_database.php:1414 /var/www/test/lib/dml/moodle_database.php:1586 /var/www/test/lib/dml/moodle_database.php:1569 /var/www/test/lib/dml/moodle_database.php:1552 /var/www/test/lib/dml/tests/dml_test.php:4249   3) dml_testcase::test_limits_and_offsets mssql_data_seek(): Bad row offset   /var/www/test/lib/dml/mssql_native_moodle_database.php:720 /var/www/test/lib/dml/mssql_native_moodle_database.php:747 /var/www/test/lib/dml/tests/dml_test.php:4446 Oracle Segmentation fault (core dumped), I tried running functional db test, but it gave "exit signal Segmentation fault". Seems to be problem with my oracle db setup. Have requested Michael to test this and will pass this after he put his comments UTF8 error/failure on all db's. But they seems to be related to my installation so ignoring them. 4) moodlelib_testcase::test_fix_utf8 iconv(): Detected an illegal character in input string   /var/www/test/lib/moodlelib.php:1130 /var/www/test/lib/tests/moodlelib_test.php:315 /var/www/test/lib/phpunit/lib.php:1124 There was 1 failure: 1) dml_testcase::test_sql_binary_equal SQL operator "=" is expected to be case sensitive Failed asserting that 1 matches expected 2.   /var/www/test/lib/dml/tests/dml_test.php:3456
            Hide
            Petr Skoda added a comment -

            postgresql: weird, please create new report if somebody from HQ manages to reproduce it
            mssql: known problem in mssql, hmmm, we should probably add some custom message and tell ppl that it breaks in mssql
            utf8: could somebody from HQ diagnose and find some solution? I can not do it because it works fine here

            thanks!!

            Show
            Petr Skoda added a comment - postgresql: weird, please create new report if somebody from HQ manages to reproduce it mssql: known problem in mssql, hmmm, we should probably add some custom message and tell ppl that it breaks in mssql utf8: could somebody from HQ diagnose and find some solution? I can not do it because it works fine here thanks!!
            Hide
            Dan Poltawski added a comment -

            The utf8 problem is plaguing most of us at HQ. The PG problem was weird.

            Show
            Dan Poltawski added a comment - The utf8 problem is plaguing most of us at HQ. The PG problem was weird.
            Hide
            Petr Skoda added a comment -

            http://php.net/manual/en/function.iconv.php clearly says "If you append the string //IGNORE, characters that cannot be represented in the target charset are silently discarded." so I guess this is bug in your installs.

            Show
            Petr Skoda added a comment - http://php.net/manual/en/function.iconv.php clearly says "If you append the string //IGNORE, characters that cannot be represented in the target charset are silently discarded." so I guess this is bug in your installs.
            Hide
            Rajesh Taneja added a comment -
            Show
            Rajesh Taneja added a comment - It will be nice to update http://docs.moodle.org/22/en/admin/environment/php_extension/iconv
            Hide
            Michael de Raadt added a comment -

            Results of the Oracle test included a couple of failures, but I don't think either is relevant to this issue.

            Time: 02:37:41, Memory: 143.75Mb
             
            There were 2 failures:
             
            1) dml_testcase::test_sql_concat
            ANSI behaviour: Concatenating NULL must return NULL - But in Oracle :-(. [%s]
            Failed asserting that '123.45test' is null.
             
            D:\xampp\htdocs\moodle_testing_oracle\lib\dml\tests\dml_test.php:3586
            D:\xampp\php\phpunit:46
             
            2) moodlesimplepie_testcase::test_getfeed
            Failed to load the sample RSS file. Please check your proxy settings in Moodle.
            %s
            Failed asserting that 'cURL Error: Operation timed out after 2012 milliseconds w
            ith 30241 out of 32188 bytes received' is null.
             
            D:\xampp\htdocs\moodle_testing_oracle\lib\tests\rsslib_test.php:56
            D:\xampp\htdocs\moodle_testing_oracle\lib\phpunit\lib.php:1058
            D:\xampp\php\phpunit:46
             
            FAILURES!
            Tests: 1070, Assertions: 20535, Failures: 2.
            

            Show
            Michael de Raadt added a comment - Results of the Oracle test included a couple of failures, but I don't think either is relevant to this issue. Time: 02:37:41, Memory: 143.75Mb   There were 2 failures:   1) dml_testcase::test_sql_concat ANSI behaviour: Concatenating NULL must return NULL - But in Oracle :-(. [%s] Failed asserting that '123.45test' is null.   D:\xampp\htdocs\moodle_testing_oracle\lib\dml\tests\dml_test.php:3586 D:\xampp\php\phpunit:46   2) moodlesimplepie_testcase::test_getfeed Failed to load the sample RSS file. Please check your proxy settings in Moodle. %s Failed asserting that 'cURL Error: Operation timed out after 2012 milliseconds w ith 30241 out of 32188 bytes received' is null.   D:\xampp\htdocs\moodle_testing_oracle\lib\tests\rsslib_test.php:56 D:\xampp\htdocs\moodle_testing_oracle\lib\phpunit\lib.php:1058 D:\xampp\php\phpunit:46   FAILURES! Tests: 1070, Assertions: 20535, Failures: 2.
            Hide
            Rajesh Taneja added a comment -

            Phphunit runs fine on all DB's.
            Passing this test, as reported failures/errors seems to be individual set-up related issues.

            Show
            Rajesh Taneja added a comment - Phphunit runs fine on all DB's. Passing this test, as reported failures/errors seems to be individual set-up related issues.
            Hide
            Dan Poltawski added a comment -

            Bonza mate!

            Your changes have made it into the Moodle release! Its time to celebrate! Put a shrimp on the barbie and grab a stubby.

            Hooroo

            Show
            Dan Poltawski added a comment - Bonza mate! Your changes have made it into the Moodle release! Its time to celebrate! Put a shrimp on the barbie and grab a stubby. Hooroo

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: