Running phpunit tests on the solr engine produces uncaught dml_read_exceptions in 3 tests: test_context_restriction - test_groups - test_user_restriction:
Fatal error: Uncaught dml_read_exception: Error reading from database (ERROR: cursor does not exist CLOSE crsXXX) in lib/dml/moodle_database.php:48
During the setup phase, the function clear_static() is called indirectly. The first step in all 3 tests is to call clear_static() again. As a result the dml_read_exceptions are thrown.