diff --git a/tests/verify_phpunit_xml.bats b/tests/verify_phpunit_xml.bats index 287c3e33..70c2ae01 100755 --- a/tests/verify_phpunit_xml.bats +++ b/tests/verify_phpunit_xml.bats @@ -13,7 +13,7 @@ teardown () { last_test || store_workspace } -@test "verify_phpunit_xml: normal run without errors" { +@test "verify_phpunit_xml: normal run without errors (old branch)" { ci_run verify_phpunit_xml/verify_phpunit_xml.sh assert_success @@ -24,6 +24,19 @@ teardown () { refute_output --partial "ERROR" } +@test "verify_phpunit_xml: normal run without errors and warnings (main branch)" { + create_git_branch main origin/main + + ci_run verify_phpunit_xml/verify_phpunit_xml.sh + + assert_success + assert_output --partial "OK: competency/tests will be executed" + assert_output --partial "INFO: backup/util/ui/tests will be executed because the backup/util definition" + assert_output --partial "INFO: Ignoring privacy/classes/tests, it does not contain any test unit file." + refute_output --partial "WARNING" + refute_output --partial "ERROR" +} + @test "verify_phpunit_xml: test detected into not covered by suite directory" { git_apply_fixture verify_phpunit_xml/add_uncovered_test.patch diff --git a/verify_phpunit_xml/create_phpunit_xml.php b/verify_phpunit_xml/create_phpunit_xml.php index 78479055..5ed664b9 100644 --- a/verify_phpunit_xml/create_phpunit_xml.php +++ b/verify_phpunit_xml/create_phpunit_xml.php @@ -79,6 +79,10 @@ cli_error('Something went wrong. Components not loaded from ' . $options['basedir']); } +// We need to register the Moodle autoloader. +require_once($options['basedir'] . '/lib/classes/component.php'); +spl_autoload_register([\core_component::class, 'classloader']); + // Now, let's invoke phpunit utils to generate the phpunit.xml file // We need to load a few stuff.