mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-02-02 00:47:32 +00:00
Update test, add expanded option
This commit is contained in:
parent
685fbe5188
commit
b123dcf079
|
@ -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.')
|
||||
;
|
||||
|
|
|
@ -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);
|
||||
|
|
8
tests/fixtures/simple/output-expanded.xml
vendored
Normal file
8
tests/fixtures/simple/output-expanded.xml
vendored
Normal 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>
|
Loading…
Reference in a new issue