mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-01-22 20:17:31 +00:00
wip
This commit is contained in:
parent
654457beee
commit
77ab5d9f9b
16
src/Builder.php
Normal file
16
src/Builder.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Opdavies\GmailFilterBuilder;
|
||||
|
||||
class Builder
|
||||
{
|
||||
private $filters = [];
|
||||
|
||||
public function __construct(array $filters) {
|
||||
$this->filters = $filters;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
}
|
||||
}
|
39
tests/Unit/BuilderTest.php
Normal file
39
tests/Unit/BuilderTest.php
Normal 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();
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue