From 3d14d004265ac6e38f3e161316cf51b7b4812414 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 12 Dec 2024 17:43:01 -0300 Subject: [PATCH] Config: add tests for the `--generator=` argument (#765) --- tests/Core/Config/GeneratorArgTest.php | 79 ++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 tests/Core/Config/GeneratorArgTest.php diff --git a/tests/Core/Config/GeneratorArgTest.php b/tests/Core/Config/GeneratorArgTest.php new file mode 100644 index 0000000000..f0b52db157 --- /dev/null +++ b/tests/Core/Config/GeneratorArgTest.php @@ -0,0 +1,79 @@ +assertSame($generatorName, $config->generator); + + }//end testGenerators() + + + /** + * Data provider for testGenerators(). + * + * @see self::testGenerators() + * + * @return array> + */ + public static function dataGeneratorNames() + { + return [ + ['Text'], + ['HTML'], + ['Markdown'], + ]; + + }//end dataGeneratorNames() + + + /** + * Ensure that only the first argument is processed and others are ignored. + * + * @return void + */ + public function testOnlySetOnce() + { + $config = new ConfigDouble( + [ + '--generator=Text', + '--generator=HTML', + '--generator=InvalidGenerator', + ] + ); + + $this->assertSame('Text', $config->generator); + + }//end testOnlySetOnce() + + +}//end class