From b123dcf079fa721b9154372c78e80fb4a90c3550 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 18 Apr 2019 21:30:58 +0100 Subject: [PATCH] Update test, add expanded option --- src/Console/Command/GenerateCommand.php | 3 ++- tests/Unit/Console/Command/GenerateFiltersTest.php | 5 +++-- tests/fixtures/simple/output-expanded.xml | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/simple/output-expanded.xml diff --git a/src/Console/Command/GenerateCommand.php b/src/Console/Command/GenerateCommand.php index 836492a..896de6f 100644 --- a/src/Console/Command/GenerateCommand.php +++ b/src/Console/Command/GenerateCommand.php @@ -24,7 +24,8 @@ class GenerateCommand extends Command ->setName(self::NAME) ->setDefinition([ new InputOption('input-file', 'i', InputOption::VALUE_OPTIONAL, 'The name of the PHP file containing your filters.', 'filters.php'), - new InputOption('output-file', 'o', InputOption::VALUE_OPTIONAL, 'The name of the XML file to generate.', 'filters.xml') + new InputOption('output-file', 'o', InputOption::VALUE_OPTIONAL, 'The name of the XML file to generate.', 'filters.xml'), + new InputOption('expanded', 'e', InputOption::VALUE_NONE, 'Whether to generate expanded XML.') ]) ->setDescription('Generates XML for Gmail filters.') ; diff --git a/tests/Unit/Console/Command/GenerateFiltersTest.php b/tests/Unit/Console/Command/GenerateFiltersTest.php index cf3755b..fb51675 100644 --- a/tests/Unit/Console/Command/GenerateFiltersTest.php +++ b/tests/Unit/Console/Command/GenerateFiltersTest.php @@ -34,16 +34,17 @@ class GenerateFiltersTest extends TestCase } /** @test */ - public function it_converts_filters_from_php_to_xml() + public function it_converts_filters_from_php_to_expanded_xml() { $this->commandTester->execute([ '--input-file' => self::INPUT_FILENAME, '--output-file' => self::OUTPUT_FILENAME, + '--expanded' => true, ]); $this->assertTrue($this->fs->exists(self::OUTPUT_FILENAME)); - $expected = file_get_contents(__DIR__ . '/../../../fixtures/simple/output.xml'); + $expected = file_get_contents(__DIR__ . '/../../../fixtures/simple/output-expanded.xml'); $result = file_get_contents(self::OUTPUT_FILENAME); $this->assertEquals(trim($expected), $result); diff --git a/tests/fixtures/simple/output-expanded.xml b/tests/fixtures/simple/output-expanded.xml new file mode 100644 index 0000000..5ab840f --- /dev/null +++ b/tests/fixtures/simple/output-expanded.xml @@ -0,0 +1,8 @@ + + + + + + + +