marinaglancy / moodle-tool_courserating

Other
1 stars 5 forks source link

Core unit test failure with Moodle 4.1 #12

Closed CarlosArceLopera closed 1 month ago

CarlosArceLopera commented 6 months ago

Hi,

I am getting the following core unit test failures after installing the plugin from master branch in Moodle 4.1:

vendor/bin/phpunit course/tests/externallib_test.php
Moodle 4.1.7+ (Build: 20231215), 07ed8e2e8a341a8ed22ecc8e2256efd0baa564a8
Php: 7.4.33, pgsql: 14.0 (Debian 14.0-1.pgdg110+1), OS: Linux 6.2.0-39-generic x86_64
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

......F.........FF..F.................F...........FF............. 65 / 91 ( 71%)
..........................                                        91 / 91 (100%)

Time: 00:20.285, Memory: 117.00 MB

There were 7 failures:

1) externallib_test::test_create_courses
Failed asserting that two objects are equal.
--- Expected
+++ Actual
@@ @@
 stdClass Object (
     'test' => 'Test value'
+    'tool_courserating' => ''
 )

/var/www/m401hq/course/tests/externallib_test.php:581
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

2) externallib_test::test_get_courses
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'shortname' => 'test'
-    'name' => 'Custom field'
-    'type' => 'text'
-    'value' => 'Test value'
-    'valueraw' => 'Test value'
+    'shortname' => 'tool_courserating'
+    'name' => 'Course rating'
+    'type' => 'textarea'
+    'value' => ''
+    'valueraw' => ''
 )

/var/www/m401hq/course/tests/externallib_test.php:826
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

3) externallib_test::test_get_courses_customfields
Failed asserting that actual size 2 matches expected size 1.

/var/www/m401hq/course/tests/externallib_test.php:870
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

4) externallib_test::test_search_courses_customfields
Failed asserting that actual size 2 matches expected size 1.

/var/www/m401hq/course/tests/externallib_test.php:1036
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

5) externallib_test::test_update_courses
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     'test' => null
+    'tool_courserating' => ''
 )

/var/www/m401hq/course/tests/externallib_test.php:1926
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

6) externallib_test::test_get_courses_by_field
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'shortname' => 'test'
-    'name' => 'Custom field'
-    'type' => 'text'
-    'value' => 'Test value'
-    'valueraw' => 'Test value'
+    'shortname' => 'tool_courserating'
+    'name' => 'Course rating'
+    'type' => 'textarea'
+    'value' => ''
+    'valueraw' => ''
 )

/var/www/m401hq/course/tests/externallib_test.php:2793
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

7) externallib_test::test_get_courses_by_field_customfields
Failed asserting that actual size 2 matches expected size 1.

/var/www/m401hq/course/tests/externallib_test.php:2953
/var/www/m401hq/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/m401hq/vendor/phpunit/phpunit/phpunit:97

FAILURES!
Tests: 91, Assertions: 604, Failures: 7.
marinaglancy commented 1 month ago

Thanks for the report. This has been fixed in version 1.6 (just released)