Skip to content

#38 : Fix Unit test static function#39

Merged
niko-hoogeveen merged 1 commit into
MOODLE_401_STABLEfrom
MOODLE_401_STABLE_issue38
Jun 9, 2026
Merged

#38 : Fix Unit test static function#39
niko-hoogeveen merged 1 commit into
MOODLE_401_STABLEfrom
MOODLE_401_STABLE_issue38

Conversation

@micoreyes

@micoreyes micoreyes commented Jun 8, 2026

Copy link
Copy Markdown

Closes issue #38 .

Environment

Moodle 5.1
PHP version: 8.4
PHP Unittest version: 11.5.55
Branch: MOODLE_401_STABLE

Testing instructions:

Run vendor/bin/phpunit public/admin/tool/redirects/tests/phpunit/regex_validator_test.php

Output without fix

There were 2 PHPUnit errors:

1) tool_redirects\regex_validator_test::test_it_validates_the_regex
The data provider specified for tool_redirects\regex_validator_test::test_it_validates_the_regex is invalid
Data Provider method tool_redirects\regex_validator_test::provider_for_test_it_validates_the_regex() is not static

/var/www/site/public/admin/tool/redirects/tests/phpunit/regex_validator_test.php:59

2) tool_redirects\regex_validator_test::test_it_throws_exception_if_regex_is_not_string
The data provider specified for tool_redirects\regex_validator_test::test_it_throws_exception_if_regex_is_not_string is invalid
Data Provider method tool_redirects\regex_validator_test::provider_for_test_it_throws_exception_if_regex_is_not_string() is not static

/var/www/site/public/admin/tool/redirects/tests/phpunit/regex_validator_test.php:83

There were 4 PHPUnit test runner warnings:
3) No tests found in class "tool_redirects\regex_validator_test".

Expected output

root@735b528fc78d:/var/www/test# vendor/bin/phpunit public/admin/tool/redirects/tests/phpunit/regex_validator_test.php
Moodle 5.1.4 (Build: 20260420)
Php: 8.3.30, mysqli: 8.4.8, OS: Linux 6.17.0-35-generic x86_64
PHPUnit 11.5.55 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.30
Configuration: /var/www/osbc/phpunit.xml

............                                                      12 / 12 (100%)

Time: 00:00.830, Memory: 82.50 MB

OK, but there were issues!
Tests: 12, Assertions: 12, PHPUnit Deprecations: 2.

@niko-hoogeveen

Copy link
Copy Markdown
Contributor

Hi Michael,

Thank you for creating this PR.

Output from unit tests:

Moodle 5.1.3+ (Build: 20260220)
Php: 8.4.22, mysqli: 8.4.9, OS: Linux 6.17.0-1025-oem x86_64
PHPUnit 11.5.12 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.22
Configuration: /var/www/upstream-mdl/phpunit.xml

...........................                                       27 / 27 (100%)

Time: 00:01.708, Memory: 70.50 MB

OK, but there were issues!
Tests: 27, Assertions: 53, PHPUnit Deprecations: 2.

This PR is approved, I will go ahead and merge this one.

@niko-hoogeveen niko-hoogeveen merged commit 9bca378 into MOODLE_401_STABLE Jun 9, 2026
34 of 35 checks passed
@niko-hoogeveen niko-hoogeveen deleted the MOODLE_401_STABLE_issue38 branch June 9, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants