Update test, add expanded option

This commit is contained in:
Oliver Davies 2019-04-18 21:30:58 +01:00
parent 685fbe5188
commit b123dcf079
3 changed files with 13 additions and 3 deletions

View file

@ -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.')
;

View file

@ -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);

View file

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
<entry>
<apps:property name='from' value='example.com'/>
<apps:property name='label' value='Test'/>
<apps:property name='shouldArchive' value='true'/>
</entry>
</feed>