Exemple #1
0
 public function testFilterTests()
 {
     $addressBookTest = new \Zimbra\Mail\Struct\AddressBookTest(10, 'header', true);
     $addressTest = new \Zimbra\Mail\Struct\AddressTest(10, 'header', 'part', 'stringComparison', 'value', true, true);
     $attachmentTest = new \Zimbra\Mail\Struct\AttachmentTest(10, true);
     $bodyTest = new \Zimbra\Mail\Struct\BodyTest(10, 'value', true, true);
     $bulkTest = new \Zimbra\Mail\Struct\BulkTest(10, true);
     $contactRankingTest = new \Zimbra\Mail\Struct\ContactRankingTest(10, 'header', true);
     $conversationTest = new \Zimbra\Mail\Struct\ConversationTest(10, 'where', true);
     $currentDayOfWeekTest = new \Zimbra\Mail\Struct\CurrentDayOfWeekTest(10, 'value', true);
     $currentTimeTest = new \Zimbra\Mail\Struct\CurrentTimeTest(10, 'dateComparison', 'time', true);
     $dateTest = new \Zimbra\Mail\Struct\DateTest(10, 'dateComparison', 10, true);
     $facebookTest = new \Zimbra\Mail\Struct\FacebookTest(10, true);
     $flaggedTest = new \Zimbra\Mail\Struct\FlaggedTest(10, 'flagName', true);
     $headerExistsTest = new \Zimbra\Mail\Struct\HeaderExistsTest(10, 'header', true);
     $headerTest = new \Zimbra\Mail\Struct\HeaderTest(10, 'header', 'stringComparison', 'value', true, true);
     $importanceTest = new \Zimbra\Mail\Struct\ImportanceTest(10, Importance::HIGH(), true);
     $inviteTest = new \Zimbra\Mail\Struct\InviteTest(10, array('method'), true);
     $linkedinTest = new \Zimbra\Mail\Struct\LinkedInTest(10, true);
     $listTest = new \Zimbra\Mail\Struct\ListTest(10, true);
     $meTest = new \Zimbra\Mail\Struct\MeTest(10, 'header', true);
     $mimeHeaderTest = new \Zimbra\Mail\Struct\MimeHeaderTest(10, 'header', 'stringComparison', 'value', true, true);
     $sizeTest = new \Zimbra\Mail\Struct\SizeTest(10, 'numberComparison', 's', true);
     $socialcastTest = new \Zimbra\Mail\Struct\SocialcastTest(10, true);
     $trueTest = new \Zimbra\Mail\Struct\TrueTest(10, true);
     $twitterTest = new \Zimbra\Mail\Struct\TwitterTest(10, true);
     $filterTests = new \Zimbra\Mail\Struct\FilterTests(FilterCondition::ALL_OF(), $addressBookTest, $addressTest, $attachmentTest, $bodyTest, $bulkTest, $contactRankingTest, $conversationTest, $currentDayOfWeekTest, $currentTimeTest, $dateTest, $facebookTest, $flaggedTest, $headerExistsTest, $headerTest, $importanceTest, $inviteTest, $linkedinTest, $listTest, $meTest, $mimeHeaderTest, $sizeTest, $socialcastTest, $trueTest, $twitterTest);
     $this->assertTrue($filterTests->condition()->is('allof'));
     $this->assertSame($addressBookTest, $filterTests->addressBookTest());
     $this->assertSame($addressTest, $filterTests->addressTest());
     $this->assertSame($attachmentTest, $filterTests->attachmentTest());
     $this->assertSame($bodyTest, $filterTests->bodyTest());
     $this->assertSame($bulkTest, $filterTests->bulkTest());
     $this->assertSame($contactRankingTest, $filterTests->contactRankingTest());
     $this->assertSame($conversationTest, $filterTests->conversationTest());
     $this->assertSame($currentDayOfWeekTest, $filterTests->currentDayOfWeekTest());
     $this->assertSame($currentTimeTest, $filterTests->currentTimeTest());
     $this->assertSame($dateTest, $filterTests->dateTest());
     $this->assertSame($facebookTest, $filterTests->facebookTest());
     $this->assertSame($flaggedTest, $filterTests->flaggedTest());
     $this->assertSame($headerExistsTest, $filterTests->headerExistsTest());
     $this->assertSame($headerTest, $filterTests->headerTest());
     $this->assertSame($importanceTest, $filterTests->importanceTest());
     $this->assertSame($inviteTest, $filterTests->inviteTest());
     $this->assertSame($linkedinTest, $filterTests->linkedinTest());
     $this->assertSame($listTest, $filterTests->listTest());
     $this->assertSame($meTest, $filterTests->meTest());
     $this->assertSame($mimeHeaderTest, $filterTests->mimeHeaderTest());
     $this->assertSame($sizeTest, $filterTests->sizeTest());
     $this->assertSame($socialcastTest, $filterTests->socialcastTest());
     $this->assertSame($trueTest, $filterTests->trueTest());
     $this->assertSame($twitterTest, $filterTests->twitterTest());
     $filterTests->condition(FilterCondition::ALL_OF())->addressBookTest($addressBookTest)->addressTest($addressTest)->attachmentTest($attachmentTest)->bodyTest($bodyTest)->bulkTest($bulkTest)->contactRankingTest($contactRankingTest)->conversationTest($conversationTest)->currentDayOfWeekTest($currentDayOfWeekTest)->currentTimeTest($currentTimeTest)->dateTest($dateTest)->facebookTest($facebookTest)->flaggedTest($flaggedTest)->headerExistsTest($headerExistsTest)->headerTest($headerTest)->importanceTest($importanceTest)->inviteTest($inviteTest)->linkedinTest($linkedinTest)->listTest($listTest)->meTest($meTest)->mimeHeaderTest($mimeHeaderTest)->sizeTest($sizeTest)->socialcastTest($socialcastTest)->trueTest($trueTest)->twitterTest($twitterTest);
     $this->assertTrue($filterTests->condition()->is('allof'));
     $this->assertSame($addressBookTest, $filterTests->addressBookTest());
     $this->assertSame($addressTest, $filterTests->addressTest());
     $this->assertSame($attachmentTest, $filterTests->attachmentTest());
     $this->assertSame($bodyTest, $filterTests->bodyTest());
     $this->assertSame($bulkTest, $filterTests->bulkTest());
     $this->assertSame($contactRankingTest, $filterTests->contactRankingTest());
     $this->assertSame($conversationTest, $filterTests->conversationTest());
     $this->assertSame($currentDayOfWeekTest, $filterTests->currentDayOfWeekTest());
     $this->assertSame($currentTimeTest, $filterTests->currentTimeTest());
     $this->assertSame($dateTest, $filterTests->dateTest());
     $this->assertSame($facebookTest, $filterTests->facebookTest());
     $this->assertSame($flaggedTest, $filterTests->flaggedTest());
     $this->assertSame($headerExistsTest, $filterTests->headerExistsTest());
     $this->assertSame($headerTest, $filterTests->headerTest());
     $this->assertSame($importanceTest, $filterTests->importanceTest());
     $this->assertSame($inviteTest, $filterTests->inviteTest());
     $this->assertSame($linkedinTest, $filterTests->linkedinTest());
     $this->assertSame($listTest, $filterTests->listTest());
     $this->assertSame($meTest, $filterTests->meTest());
     $this->assertSame($mimeHeaderTest, $filterTests->mimeHeaderTest());
     $this->assertSame($sizeTest, $filterTests->sizeTest());
     $this->assertSame($socialcastTest, $filterTests->socialcastTest());
     $this->assertSame($trueTest, $filterTests->trueTest());
     $this->assertSame($twitterTest, $filterTests->twitterTest());
     $xml = '<?xml version="1.0"?>' . "\n" . '<filterTests condition="allof">' . '<addressBookTest index="10" negative="true" header="header" />' . '<addressTest index="10" negative="true" header="header" part="part" stringComparison="stringComparison" value="value" caseSensitive="true" />' . '<attachmentTest index="10" negative="true" />' . '<bodyTest index="10" negative="true" value="value" caseSensitive="true" />' . '<bulkTest index="10" negative="true" />' . '<contactRankingTest index="10" negative="true" header="header" />' . '<conversationTest index="10" negative="true" where="where" />' . '<currentDayOfWeekTest index="10" negative="true" value="value" />' . '<currentTimeTest index="10" negative="true" dateComparison="dateComparison" time="time" />' . '<dateTest index="10" negative="true" dateComparison="dateComparison" d="10" />' . '<facebookTest index="10" negative="true" />' . '<flaggedTest index="10" negative="true" flagName="flagName" />' . '<headerExistsTest index="10" negative="true" header="header" />' . '<headerTest index="10" negative="true" header="header" stringComparison="stringComparison" value="value" caseSensitive="true" />' . '<importanceTest index="10" negative="true" imp="high" />' . '<inviteTest index="10" negative="true">' . '<method>method</method>' . '</inviteTest>' . '<linkedinTest index="10" negative="true" />' . '<listTest index="10" negative="true" />' . '<meTest index="10" negative="true" header="header" />' . '<mimeHeaderTest index="10" negative="true" header="header" stringComparison="stringComparison" value="value" caseSensitive="true" />' . '<sizeTest index="10" negative="true" numberComparison="numberComparison" s="s" />' . '<socialcastTest index="10" negative="true" />' . '<trueTest index="10" negative="true" />' . '<twitterTest index="10" negative="true" />' . '</filterTests>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $filterTests);
     $array = array('filterTests' => array('condition' => 'allof', 'addressBookTest' => array('index' => 10, 'negative' => true, 'header' => 'header'), 'addressTest' => array('index' => 10, 'negative' => true, 'header' => 'header', 'part' => 'part', 'stringComparison' => 'stringComparison', 'value' => 'value', 'caseSensitive' => true), 'attachmentTest' => array('index' => 10, 'negative' => true), 'bodyTest' => array('index' => 10, 'negative' => true, 'value' => 'value', 'caseSensitive' => true), 'bulkTest' => array('index' => 10, 'negative' => true), 'contactRankingTest' => array('index' => 10, 'negative' => true, 'header' => 'header'), 'conversationTest' => array('index' => 10, 'negative' => true, 'where' => 'where'), 'currentDayOfWeekTest' => array('index' => 10, 'negative' => true, 'value' => 'value'), 'currentTimeTest' => array('index' => 10, 'negative' => true, 'dateComparison' => 'dateComparison', 'time' => 'time'), 'dateTest' => array('index' => 10, 'negative' => true, 'dateComparison' => 'dateComparison', 'd' => 10), 'facebookTest' => array('index' => 10, 'negative' => true), 'flaggedTest' => array('index' => 10, 'negative' => true, 'flagName' => 'flagName'), 'headerExistsTest' => array('index' => 10, 'negative' => true, 'header' => 'header'), 'headerTest' => array('index' => 10, 'negative' => true, 'header' => 'header', 'stringComparison' => 'stringComparison', 'value' => 'value', 'caseSensitive' => true), 'importanceTest' => array('index' => 10, 'negative' => true, 'imp' => 'high'), 'inviteTest' => array('index' => 10, 'negative' => true, 'method' => array('method')), 'linkedinTest' => array('index' => 10, 'negative' => true), 'listTest' => array('index' => 10, 'negative' => true), 'meTest' => array('index' => 10, 'negative' => true, 'header' => 'header'), 'mimeHeaderTest' => array('index' => 10, 'negative' => true, 'header' => 'header', 'stringComparison' => 'stringComparison', 'value' => 'value', 'caseSensitive' => true), 'sizeTest' => array('index' => 10, 'negative' => true, 'numberComparison' => 'numberComparison', 's' => 's'), 'socialcastTest' => array('index' => 10, 'negative' => true), 'trueTest' => array('index' => 10, 'negative' => true), 'twitterTest' => array('index' => 10, 'negative' => true)));
     $this->assertEquals($array, $filterTests->toArray());
 }