Skip to content

4.5 unittest failing due to mod_qbank not present as core Moodle in 4.5 #69

@micoreyes

Description

@micoreyes

Describe the bug
There are multiple tests that are failing due to mod_qbank reference in multiple tests file.

vendor/bin/phpunit question/type/aitext/tests/aitext_repeated_restore_test.php 
Moodle 4.5.10+ (Build: 20260227), 87a287889e272cd783c6bb8b907305ff463c5663
Php: 8.3.30, mysqli: 8.0.45, OS: Linux 6.17.0-14-generic x86_64
PHPUnit 9.6.18 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 00:00.257, Memory: 92.50 MB

There was 1 error:

1) qtype_aitext\aitext_repeated_restore_test::test_restore_quiz_with_duplicate_aitext_questions
core\exception\coding_exception: Coding error detected, it must be fixed by a programmer: Component mod_qbank does not support generators yet. Missing tests/generator/lib.php.

/var/www/client/lib/testing/generator/data_generator.php:1605
/var/www/client/lib/testing/generator/data_generator.php:123
/var/www/client/question/type/aitext/tests/aitext_repeated_restore_test.php:67
/var/www/client/lib/phpunit/classes/advanced_testcase.php:76



vendor/bin/phpunit question/type/aitext/tests/restore_test.php 
Moodle 4.5.10+ (Build: 20260227), 87a287889e272cd783c6bb8b907305ff463c5663
Php: 8.3.30, mysqli: 8.0.45, OS: Linux 6.17.0-14-generic x86_64
PHPUnit 9.6.18 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 00:00.412, Memory: 92.50 MB

There was 1 error:

1) qtype_aitext\restore_test::test_backup_and_restore
core\exception\coding_exception: Coding error detected, it must be fixed by a programmer: Component mod_qbank does not support generators yet. Missing tests/generator/lib.php.

/var/www/client/lib/testing/generator/data_generator.php:1605
/var/www/client/lib/testing/generator/data_generator.php:123
/var/www/client/lib/testing/generator/data_generator.php:523
/var/www/client/question/type/aitext/tests/restore_test.php:52
/var/www/client/lib/phpunit/classes/advanced_testcase.php:76

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

To Reproduce
Steps to reproduce the behavior:

  1. Initialized a 4.5 moodle site.
  2. Install the plugin. Use latest version 1.01
  3. Initialize PHPUNIT
  4. Run this following tests
  • vendor/bin/phpunit question/type/aitext/tests/restore_test.php
  • vendor/bin/phpunit question/type/aitext/tests/aitext_repeated_restore_test.php

Expected behavior
It should return green unittest.

Screenshots

Setup (please complete the following information):

Additional context
tests/restore_test.php:52 and :67
tests/aitext_repeated_restore_test.php:67

mod_qbank is only referenced in test files. mod_qbank is only available in Moodle 5.0. If we use the branch aitext_1.01 the issue still persists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions