Skip to content

Failing core unit tests duo to incorrect default value #169

@ScottVerbeek

Description

@ScottVerbeek

The core unit test adminlib_test::test_admin_output_new_settings_by_page tests that extra settings in additional plugins are configured with default plugins. If there is no default value, then a workaround must be created into their db/install.php for PHPUnit and Behat tests.

The output of the core tests on Moodle 4.3
root@c3e2c38a9c70:/var/www/vanilla-403# vendor/bin/phpunit --filter test_admin_output_new_settings_by_page
Moodle 4.3.2+ (Build: 20240104), 40890bf181407b0a84990916070ff1b9b0357716
Php: 8.1.24, pgsql: 14.0 (Debian 14.0-1.pgdg110+1), OS: Linux 6.4.12-060412-generic x86_64
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

F                                                                   1 / 1 (100%)

Time: 00:01.121, Memory: 364.00 MB

There was 1 failure:

1) core\adminlib_test::test_admin_output_new_settings_by_page
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
-Array &0 ()
+Array &0 (
+    'cleaner_custom_sql_pre' => '-->New settings - Execute custom database query at pre-wash\n
+<fieldset class="adminsettings">\n
+<div class="clearer"><!-- --></div>\n
+<div class="form-item row" id="admin-sql">\n
+    <div class="form-label col-sm-3 text-sm-right">\n
+            <label for="id_s_cleaner_custom_sql_pre_sql">\n
+                SQL\n
+            </label>\n
+        <span class="form-shortname d-block small text-muted">cleaner_custom_sql_pre | sql</span>\n
+    </div>\n
+    <div class="form-setting col-sm-9">\n
+        <div class="form-textarea">\n
+    <textarea  rows="8" cols="60" id="id_s_cleaner_custom_sql_pre_sql" name="s_cleaner_custom_sql_pre_sql" spellcheck="true" class="form-control text-ltr"></textarea>\n
+</div>\n
+        <div class="form-description mt-3"><p>SQL to be executed at the end of pre-wash.</p>\n
+</div>\n
+        \n
+    </div>\n
+</div></fieldset>'
+    'cleaner_custom_sql_post' => '-->New settings - Execute custom database query at post-wash\n
+<fieldset class="adminsettings">\n
+<div class="clearer"><!-- --></div>\n
+<div class="form-item row" id="admin-sql">\n
+    <div class="form-label col-sm-3 text-sm-right">\n
+            <label for="id_s_cleaner_custom_sql_post_sql">\n
+                SQL\n
+            </label>\n
+        <span class="form-shortname d-block small text-muted">cleaner_custom_sql_post | sql</span>\n
+    </div>\n
+    <div class="form-setting col-sm-9">\n
+        <div class="form-textarea">\n
+    <textarea  rows="8" cols="60" id="id_s_cleaner_custom_sql_post_sql" name="s_cleaner_custom_sql_post_sql" spellcheck="true" class="form-control text-ltr"></textarea>\n
+</div>\n
+        <div class="form-description mt-3"><p>SQL to be executed at the end of post-wash.</p>\n
+</div>\n
+        \n
+    </div>\n
+</div></fieldset>'
+)

/var/www/vanilla-403/lib/tests/adminlib_test.php:151
/var/www/vanilla-403/lib/phpunit/classes/advanced_testcase.php:81

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions