diff --git a/src/PluginValidate/Requirements/DataformatRequirements.php b/src/PluginValidate/Requirements/DataformatRequirements.php new file mode 100644 index 00000000..491c02ef --- /dev/null +++ b/src/PluginValidate/Requirements/DataformatRequirements.php @@ -0,0 +1,26 @@ +getLangFile())->mustHave('dataformat'); + } +} diff --git a/src/PluginValidate/Requirements/RequirementsResolver.php b/src/PluginValidate/Requirements/RequirementsResolver.php index f3d72eb5..a57a383b 100644 --- a/src/PluginValidate/Requirements/RequirementsResolver.php +++ b/src/PluginValidate/Requirements/RequirementsResolver.php @@ -32,6 +32,7 @@ public function resolveRequirements(Plugin $plugin, $moodleVersion) $map = [ 'auth' => new AuthRequirements($plugin, $moodleVersion), 'block' => new BlockRequirements($plugin, $moodleVersion), + 'dataformat' => new DataformatRequirements($plugin, $moodleVersion), 'filter' => new FilterRequirements($plugin, $moodleVersion), 'format' => new FormatRequirements($plugin, $moodleVersion), 'mod' => new ModuleRequirements($plugin, $moodleVersion), diff --git a/tests/PluginValidate/Requirements/DataformatRequirementsTest.php b/tests/PluginValidate/Requirements/DataformatRequirementsTest.php new file mode 100644 index 00000000..aeadbdc2 --- /dev/null +++ b/tests/PluginValidate/Requirements/DataformatRequirementsTest.php @@ -0,0 +1,52 @@ +requirements = new DataformatRequirements(new Plugin('dataformat_csv', 'dataformat', 'csv', ''), 29); + } + + protected function tearDown(): void + { + $this->requirements = null; + } + + public function testResolveRequirements() + { + $resolver = new RequirementsResolver(); + + $this->assertInstanceOf( + 'MoodlePluginCI\PluginValidate\Requirements\DataformatRequirements', + $resolver->resolveRequirements(new Plugin('', 'dataformat', '', ''), 29) + ); + } + + public function testGetRequiredStrings() + { + $fileToken = $this->requirements->getRequiredStrings(); + $this->assertInstanceOf('MoodlePluginCI\PluginValidate\Finder\FileTokens', $fileToken); + $this->assertSame('lang/en/dataformat_csv.php', $fileToken->file); + } +}