diff --git a/tests/GmailFilterTest.php b/tests/GmailFilterTest.php index ad4a5c8..265013d 100644 --- a/tests/GmailFilterTest.php +++ b/tests/GmailFilterTest.php @@ -2,23 +2,45 @@ class GmailFilterTest extends \PHPUnit_Framework_TestCase { + + /** + * @var GmailFilter + */ + private $filter; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->filter = new GmailFilter(); + } + public function testSingleFrom() { - $filters[] = GmailFilter::create() - ->from(['foo@example.com']); - // TODO: Does this need to be done each time? - $builder = (string) new GmailFilterBuilder($filters); + $output = $this->createBuilder([ + $this->filter->from(['foo@example.com']) + ]); - $this->assertContains('', $builder); + $this->assertContains('', $output); } public function testMultipleFrom() { - $filters[] = GmailFilter::create() - ->from(['foo@example.com', 'bar@example.com']); + $output = $this->createBuilder([ + $this->filter->from(['foo@example.com', 'bar@example.com']) + ]); - // TODO: Does this need to be done each time? - $builder = (string) new GmailFilterBuilder($filters); - - $this->assertContains('', $builder); + $this->assertContains('', $output); } + + /** + * @param GmailFilter[] $filters An array of filters. + * + * @return string A string representation of GmailFilterBuilder. + */ + private function createBuilder($filters) { + return (string) new GmailFilterBuilder($filters); + } + }