ndunand / moodle-enrol_attributes

This plugin allows users to be enrolled according to any value stored in their user profile.
https://moodle.org/plugins/enrol_attributes
18 stars 22 forks source link

Patch for PGSQL (9e37cf5) causes syntax error in MariaDB with Moodle 3.9 #44

Closed katerynadegtyariova closed 2 years ago

katerynadegtyariova commented 2 years ago

The patch for PGSQL syntax error causes syntax error in MariaDB with Moodle 3.9.

Run unit tests as follows: vendor/bin/phpunit --stop-on-failure "attributes_testcase" enrol/attributes/tests/attributes_test.php

The resulting output is this:

Php: 7.4.25, mysqli: 5.7.36, OS: Linux 5.4.0-91-generic x86_64
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

..E

Time: 57.82 seconds, Memory: 68.50 MB

There was 1 error:

1) attributes_testcase::testUnenrolUser
dml_read_exception: Error reading from database (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SELECT DISTINCT u.id FROM phpu_user u WHERE u.id=581000 AND u.deleted=0 AND 
[array (
)])

/var/www/cssrp/lib/dml/moodle_database.php:486
/var/www/cssrp/lib/dml/mysqli_native_moodle_database.php:1273
/var/www/cssrp/enrol/attributes/lib.php:165
/var/www/cssrp/enrol/attributes/tests/attributes_test.php:121
/var/www/cssrp/enrol/attributes/tests/attributes_test.php:98
/var/www/cssrp/lib/phpunit/classes/advanced_testcase.php:80
/var/www/cssrp/vendor/phpunit/phpunit/phpunit:60
katerynadegtyariova commented 2 years ago

This issue is fixed by Pull request #42