. namespace core\db; // phpcs:disable moodle.PHPUnit.TestCaseProvider.dataProviderSyntaxMethodNotFound /** * Detect common problems in plugin database structures. * * @group plugin_checks * @package core * @copyright 2025 Petr Skoda * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ final class plugin_checks_test extends \core\tests\plugin_checks_testcase { /** * Verify plugin db/install.xml file. * * @dataProvider all_plugins_provider * @coversNothing * * @param string $component * @param string $plugintype * @param string $pluginname * @param string $dir */ public function test_db_install_file(string $component, string $plugintype, string $pluginname, string $dir): void { global $DB; $DB->get_manager(); // Preload XMLDB classes. $file = "$dir/db/install.xml"; if (!file_exists($file)) { $this->expectNotToPerformAssertions(); return; } $rawcontents = file_get_contents($file); $xmldb = new \xmldb_file($file); $xmldb->loadXMLStructure(); $xmlcontents = $xmldb->getStructure()->xmlOutput(); $this->assertXmlStringEqualsXmlString( $rawcontents, $xmlcontents, "XMLDB structure does not match the install.xml file in $file", ); } }