This commit is contained in:
Oliver Davies 2017-11-04 00:32:39 +00:00
parent 654457beee
commit 77ab5d9f9b
3 changed files with 56 additions and 2 deletions

16
src/Builder.php Normal file
View file

@ -0,0 +1,16 @@
<?php
namespace Opdavies\GmailFilterBuilder;
class Builder
{
private $filters = [];
public function __construct(array $filters) {
$this->filters = $filters;
}
public function build()
{
}
}

View file

@ -0,0 +1,39 @@
<?php
use Opdavies\GmailFilterBuilder\Builder;
use Opdavies\GmailFilterBuilder\Filter;
class BuilderTest extends \PHPUnit_Framework_TestCase
{
public function testBuild()
{
$filterA = $this->getMockBuilder(Filter::class)
->setMethods(['getProperties'])
->getMock();
$filterB = $this->getMockBuilder(Filter::class)
->setMethods(['getProperties'])
->getMock();
$filterA->method('getProperties')
->willReturn(
[
['from' => 'foo@example.com'],
['shouldStar' => true],
]
);
$filterB->method('getProperties')
->willReturn(
[
['to' => 'bar@example.com'],
]
);
$builder = new Builder([
$filterA->getProperties(),
$filterB->getProperties(),
]);
$builder->build();
}
}

View file

@ -56,8 +56,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase
// Ensure that we can set multiple from addresses.
$this->assertEquals(
['from' => ['foo@example.com', 'bar@example.com']],
$this->filter
->from('foo@example.com', 'bar@example.com')
$this->filter->from('foo@example.com', 'bar@example.com')
->getProperties()
);
}