mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-09-05 21:15:33 +01:00
Organise tests
This commit is contained in:
parent
71951f0384
commit
1b8c79f33b
2 changed files with 3 additions and 1 deletions
43
tests/Unit/Service/BuilderTest.php
Normal file
43
tests/Unit/Service/BuilderTest.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Opdavies\Tests\GmailFilterBuilder\Service;
|
||||
|
||||
use Opdavies\GmailFilterBuilder\Model\Filter;
|
||||
use Opdavies\GmailFilterBuilder\Service\Builder;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BuilderTest extends TestCase
|
||||
{
|
||||
public function testBuild()
|
||||
{
|
||||
$filterA = (new Filter())
|
||||
->from(['foo@example.com', 'test@example.com'])
|
||||
->label('Some label')
|
||||
->archive();
|
||||
|
||||
$filterB = (new Filter())
|
||||
->has('from:bar@example.com')
|
||||
->star()
|
||||
->important();
|
||||
|
||||
$result = new Builder([$filterA, $filterB], '', false);
|
||||
|
||||
$expected = <<<EOF
|
||||
<?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='(foo@example.com|test@example.com)'/>
|
||||
<apps:property name='label' value='Some label'/>
|
||||
<apps:property name='shouldArchive' value='true'/>
|
||||
</entry>
|
||||
<entry>
|
||||
<apps:property name='hasTheWord' value='from:bar@example.com'/>
|
||||
<apps:property name='shouldStar' value='true'/>
|
||||
<apps:property name='shouldAlwaysMarkAsImportant' value='true'/>
|
||||
</entry>
|
||||
</feed>
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($expected, $result->getXml());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue