Esempio n. 1
0
 public function testMdsConnectionType()
 {
     $values = array('cleartext', 'ssl', 'tls', 'tls_is_available');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\MdsConnectionType::has($value));
     }
 }
Esempio n. 2
0
 public function testTestDataSource()
 {
     $imap = new \Zimbra\Mail\Struct\MailImapDataSource('id', 'name', 'l', true, true, 'host', 10, MdsConnectionType::SSL(), 'username', 'password', 'pollingInterval', 'emailAddress', true, 'defaultSignature', 'forwardReplySignature', 'fromDisplay', 'replyToAddress', 'replyToDisplay', 'importClass', 10, 'lastError', array('a', 'b'));
     $pop3 = new \Zimbra\Mail\Struct\MailPop3DataSource(true);
     $caldav = new \Zimbra\Mail\Struct\MailCaldavDataSource();
     $yab = new \Zimbra\Mail\Struct\MailYabDataSource();
     $rss = new \Zimbra\Mail\Struct\MailRssDataSource();
     $gal = new \Zimbra\Mail\Struct\MailGalDataSource();
     $cal = new \Zimbra\Mail\Struct\MailCalDataSource();
     $unknown = new \Zimbra\Mail\Struct\MailUnknownDataSource();
     $this->_api->testImapDataSource($imap);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:imap id="id" name="name" l="l" isEnabled="true" importOnly="true" host="host" port="10" ' . 'connectionType="ssl" username="******" password="******" pollingInterval="pollingInterval" ' . 'emailAddress="emailAddress" useAddressForForwardReply="true" defaultSignature="defaultSignature" ' . 'forwardReplySignature="forwardReplySignature" fromDisplay="fromDisplay" replyToAddress="replyToAddress" ' . 'replyToDisplay="replyToDisplay" importClass="importClass" failingSince="10">' . '<urn1:lastError>lastError</urn1:lastError>' . '<urn1:a>a</urn1:a>' . '<urn1:a>b</urn1:a>' . '</urn1:imap>' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testPop3DataSource($pop3);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:pop3 leaveOnServer="true" />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testCaldavDataSource($caldav);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:caldav />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testYabDataSource($yab);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:yab />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testRssDataSource($rss);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:rss />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testGalDataSource($gal);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:gal />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testCalDataSource($cal);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:cal />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $this->_api->testUnknownDataSource($unknown);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:TestDataSourceRequest>' . '<urn1:unknown />' . '</urn1:TestDataSourceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Esempio n. 3
0
 public function testMailDataSource()
 {
     $id = $this->faker->uuid;
     $name = $this->faker->word;
     $folder = $this->faker->word;
     $host = $this->faker->ipv4;
     $username = $this->faker->userName;
     $password = $this->faker->word;
     $pollingInterval = $this->faker->word;
     $emailAddress = $this->faker->email;
     $defaultSignature = $this->faker->word;
     $forwardReplySignature = $this->faker->word;
     $fromDisplay = $this->faker->word;
     $replyToAddress = $this->faker->word;
     $replyToDisplay = $this->faker->word;
     $importClass = $this->faker->word;
     $lastError = $this->faker->word;
     $a = $this->faker->word;
     $b = $this->faker->word;
     $c = $this->faker->word;
     $port = mt_rand(1, 100);
     $failingSince = mt_rand(1, 100);
     $mail = new \Zimbra\Mail\Struct\MailDataSource($id, $name, $folder, true, true, $host, $port, MdsConnectionType::SSL(), $username, $password, $pollingInterval, $emailAddress, true, $defaultSignature, $forwardReplySignature, $fromDisplay, $replyToAddress, $replyToDisplay, $importClass, $failingSince, $lastError, array($a, $b));
     $this->assertSame($id, $mail->getId());
     $this->assertSame($name, $mail->getName());
     $this->assertSame($folder, $mail->getFolderId());
     $this->assertTrue($mail->getEnabled());
     $this->assertTrue($mail->getImportOnly());
     $this->assertSame($host, $mail->getHost());
     $this->assertSame($port, $mail->getPort());
     $this->assertTrue($mail->getMdsConnectionType()->is('ssl'));
     $this->assertSame($username, $mail->getUsername());
     $this->assertSame($password, $mail->getPassword());
     $this->assertSame($pollingInterval, $mail->getPollingInterval());
     $this->assertSame($emailAddress, $mail->getEmailAddress());
     $this->assertTrue($mail->getUseAddressForForwardReply());
     $this->assertSame($defaultSignature, $mail->getDefaultSignature());
     $this->assertSame($forwardReplySignature, $mail->getForwardReplySignature());
     $this->assertSame($fromDisplay, $mail->getFromDisplay());
     $this->assertSame($replyToAddress, $mail->getReplyToAddress());
     $this->assertSame($replyToDisplay, $mail->getReplyToDisplay());
     $this->assertSame($importClass, $mail->getImportClass());
     $this->assertSame($failingSince, $mail->getFailingSince());
     $this->assertSame($lastError, $mail->getLastError());
     $this->assertSame([$a, $b], $mail->getAttributes()->all());
     $mail->setId($id)->setName($name)->setFolderId($folder)->setEnabled(true)->setImportOnly(true)->setHost($host)->setPort($port)->setMdsConnectionType(MdsConnectionType::SSL())->setUsername($username)->setPassword($password)->setPollingInterval($pollingInterval)->setEmailAddress($emailAddress)->setUseAddressForForwardReply(true)->setDefaultSignature($defaultSignature)->setForwardReplySignature($forwardReplySignature)->setFromDisplay($fromDisplay)->setReplyToAddress($replyToAddress)->setReplyToDisplay($replyToDisplay)->setImportClass($importClass)->setFailingSince($failingSince)->setLastError($lastError)->addAttribute($c);
     $this->assertSame($id, $mail->getId());
     $this->assertSame($name, $mail->getName());
     $this->assertSame($folder, $mail->getFolderId());
     $this->assertTrue($mail->getEnabled());
     $this->assertTrue($mail->getImportOnly());
     $this->assertSame($host, $mail->getHost());
     $this->assertSame($port, $mail->getPort());
     $this->assertTrue($mail->getMdsConnectionType()->is('ssl'));
     $this->assertSame($username, $mail->getUsername());
     $this->assertSame($password, $mail->getPassword());
     $this->assertSame($pollingInterval, $mail->getPollingInterval());
     $this->assertSame($emailAddress, $mail->getEmailAddress());
     $this->assertTrue($mail->getUseAddressForForwardReply());
     $this->assertSame($defaultSignature, $mail->getDefaultSignature());
     $this->assertSame($forwardReplySignature, $mail->getForwardReplySignature());
     $this->assertSame($fromDisplay, $mail->getFromDisplay());
     $this->assertSame($replyToAddress, $mail->getReplyToAddress());
     $this->assertSame($replyToDisplay, $mail->getReplyToDisplay());
     $this->assertSame($importClass, $mail->getImportClass());
     $this->assertSame($failingSince, $mail->getFailingSince());
     $this->assertSame($lastError, $mail->getLastError());
     $this->assertSame([$a, $b, $c], $mail->getAttributes()->all());
     $xml = '<?xml version="1.0"?>' . "\n" . '<mail id="' . $id . '" name="' . $name . '" l="' . $folder . '" isEnabled="true" importOnly="true" host="' . $host . '" port="' . $port . '" ' . 'connectionType="' . MdsConnectionType::SSL() . '" username="******" password="******" pollingInterval="' . $pollingInterval . '" ' . 'emailAddress="' . $emailAddress . '" useAddressForForwardReply="true" defaultSignature="' . $defaultSignature . '" ' . 'forwardReplySignature="' . $forwardReplySignature . '" fromDisplay="' . $fromDisplay . '" replyToAddress="' . $replyToAddress . '" ' . 'replyToDisplay="' . $replyToDisplay . '" importClass="' . $importClass . '" failingSince="' . $failingSince . '">' . '<lastError>' . $lastError . '</lastError>' . '<a>' . $a . '</a>' . '<a>' . $b . '</a>' . '<a>' . $c . '</a>' . '</mail>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $mail);
     $array = array('mail' => array('id' => $id, 'name' => $name, 'l' => $folder, 'isEnabled' => true, 'importOnly' => true, 'host' => $host, 'port' => $port, 'connectionType' => MdsConnectionType::SSL()->value(), 'username' => $username, 'password' => $password, 'pollingInterval' => $pollingInterval, 'emailAddress' => $emailAddress, 'useAddressForForwardReply' => true, 'defaultSignature' => $defaultSignature, 'forwardReplySignature' => $forwardReplySignature, 'fromDisplay' => $fromDisplay, 'replyToAddress' => $replyToAddress, 'replyToDisplay' => $replyToDisplay, 'importClass' => $importClass, 'failingSince' => $failingSince, 'lastError' => $lastError, 'a' => [$a, $b, $c]));
     $this->assertEquals($array, $mail->toArray());
 }
Esempio n. 4
0
 public function testMailDataSource()
 {
     $mail = new \Zimbra\Mail\Struct\MailDataSource('id', 'name', 'l', true, true, 'host', 10, MdsConnectionType::SSL(), 'username', 'password', 'pollingInterval', 'emailAddress', true, 'defaultSignature', 'forwardReplySignature', 'fromDisplay', 'replyToAddress', 'replyToDisplay', 'importClass', 10, 'lastError', array('a', 'b'));
     $this->assertSame('id', $mail->id());
     $this->assertSame('name', $mail->name());
     $this->assertSame('l', $mail->l());
     $this->assertTrue($mail->isEnabled());
     $this->assertTrue($mail->importOnly());
     $this->assertSame('host', $mail->host());
     $this->assertSame(10, $mail->port());
     $this->assertTrue($mail->connectionType()->is('ssl'));
     $this->assertSame('username', $mail->username());
     $this->assertSame('password', $mail->password());
     $this->assertSame('pollingInterval', $mail->pollingInterval());
     $this->assertSame('emailAddress', $mail->emailAddress());
     $this->assertTrue($mail->useAddressForForwardReply());
     $this->assertSame('defaultSignature', $mail->defaultSignature());
     $this->assertSame('forwardReplySignature', $mail->forwardReplySignature());
     $this->assertSame('fromDisplay', $mail->fromDisplay());
     $this->assertSame('replyToAddress', $mail->replyToAddress());
     $this->assertSame('replyToDisplay', $mail->replyToDisplay());
     $this->assertSame('importClass', $mail->importClass());
     $this->assertSame(10, $mail->failingSince());
     $this->assertSame('lastError', $mail->lastError());
     $this->assertSame(array('a', 'b'), $mail->a()->all());
     $mail->id('id')->name('name')->l('l')->isEnabled(true)->importOnly(true)->host('host')->port(10)->connectionType(MdsConnectionType::SSL())->username('username')->password('password')->pollingInterval('pollingInterval')->emailAddress('emailAddress')->useAddressForForwardReply(true)->defaultSignature('defaultSignature')->forwardReplySignature('forwardReplySignature')->fromDisplay('fromDisplay')->replyToAddress('replyToAddress')->replyToDisplay('replyToDisplay')->importClass('importClass')->failingSince(10)->lastError('lastError')->addA('c');
     $this->assertSame('id', $mail->id());
     $this->assertSame('name', $mail->name());
     $this->assertSame('l', $mail->l());
     $this->assertTrue($mail->isEnabled());
     $this->assertTrue($mail->importOnly());
     $this->assertSame('host', $mail->host());
     $this->assertSame(10, $mail->port());
     $this->assertTrue($mail->connectionType()->is('ssl'));
     $this->assertSame('username', $mail->username());
     $this->assertSame('password', $mail->password());
     $this->assertSame('pollingInterval', $mail->pollingInterval());
     $this->assertSame('emailAddress', $mail->emailAddress());
     $this->assertTrue($mail->useAddressForForwardReply());
     $this->assertSame('defaultSignature', $mail->defaultSignature());
     $this->assertSame('forwardReplySignature', $mail->forwardReplySignature());
     $this->assertSame('fromDisplay', $mail->fromDisplay());
     $this->assertSame('replyToAddress', $mail->replyToAddress());
     $this->assertSame('replyToDisplay', $mail->replyToDisplay());
     $this->assertSame('importClass', $mail->importClass());
     $this->assertSame(10, $mail->failingSince());
     $this->assertSame('lastError', $mail->lastError());
     $this->assertSame(array('a', 'b', 'c'), $mail->a()->all());
     $xml = '<?xml version="1.0"?>' . "\n" . '<mail id="id" name="name" l="l" isEnabled="true" importOnly="true" host="host" port="10" ' . 'connectionType="ssl" username="******" password="******" pollingInterval="pollingInterval" ' . 'emailAddress="emailAddress" useAddressForForwardReply="true" defaultSignature="defaultSignature" ' . 'forwardReplySignature="forwardReplySignature" fromDisplay="fromDisplay" replyToAddress="replyToAddress" ' . 'replyToDisplay="replyToDisplay" importClass="importClass" failingSince="10">' . '<lastError>lastError</lastError>' . '<a>a</a>' . '<a>b</a>' . '<a>c</a>' . '</mail>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $mail);
     $array = array('mail' => array('id' => 'id', 'name' => 'name', 'l' => 'l', 'isEnabled' => true, 'importOnly' => true, 'host' => 'host', 'port' => 10, 'connectionType' => 'ssl', 'username' => 'username', 'password' => 'password', 'pollingInterval' => 'pollingInterval', 'emailAddress' => 'emailAddress', 'useAddressForForwardReply' => true, 'defaultSignature' => 'defaultSignature', 'forwardReplySignature' => 'forwardReplySignature', 'fromDisplay' => 'fromDisplay', 'replyToAddress' => 'replyToAddress', 'replyToDisplay' => 'replyToDisplay', 'importClass' => 'importClass', 'failingSince' => 10, 'lastError' => 'lastError', 'a' => array('a', 'b', 'c')));
     $this->assertEquals($array, $mail->toArray());
 }
Esempio n. 5
0
 public function testTestDataSource()
 {
     $pop3 = new \Zimbra\Mail\Struct\MailPop3DataSource(true);
     $req = new \Zimbra\Mail\Request\TestDataSource($pop3);
     $this->assertSame($pop3, $req->pop3());
     $req->pop3($pop3);
     $this->assertSame($pop3, $req->pop3());
     $caldav = new \Zimbra\Mail\Struct\MailCaldavDataSource();
     $req = new \Zimbra\Mail\Request\TestDataSource($caldav);
     $this->assertSame($caldav, $req->caldav());
     $req->caldav($caldav);
     $this->assertSame($caldav, $req->caldav());
     $yab = new \Zimbra\Mail\Struct\MailYabDataSource();
     $req = new \Zimbra\Mail\Request\TestDataSource($yab);
     $this->assertSame($yab, $req->yab());
     $req->yab($yab);
     $this->assertSame($yab, $req->yab());
     $rss = new \Zimbra\Mail\Struct\MailRssDataSource();
     $req = new \Zimbra\Mail\Request\TestDataSource($rss);
     $this->assertSame($rss, $req->rss());
     $req->rss($rss);
     $this->assertSame($rss, $req->rss());
     $gal = new \Zimbra\Mail\Struct\MailGalDataSource();
     $req = new \Zimbra\Mail\Request\TestDataSource($gal);
     $this->assertSame($gal, $req->gal());
     $req->gal($gal);
     $this->assertSame($gal, $req->gal());
     $cal = new \Zimbra\Mail\Struct\MailCalDataSource();
     $req = new \Zimbra\Mail\Request\TestDataSource($cal);
     $this->assertSame($cal, $req->cal());
     $req->cal($cal);
     $this->assertSame($cal, $req->cal());
     $unknown = new \Zimbra\Mail\Struct\MailUnknownDataSource();
     $req = new \Zimbra\Mail\Request\TestDataSource($unknown);
     $this->assertSame($unknown, $req->unknown());
     $req->unknown($unknown);
     $this->assertSame($unknown, $req->unknown());
     $imap = new \Zimbra\Mail\Struct\MailImapDataSource('id', 'name', 'l', true, true, 'host', 10, MdsConnectionType::SSL(), 'username', 'password', 'pollingInterval', 'emailAddress', true, 'defaultSignature', 'forwardReplySignature', 'fromDisplay', 'replyToAddress', 'replyToDisplay', 'importClass', 10, 'lastError', array('a', 'b'));
     $req = new \Zimbra\Mail\Request\TestDataSource($imap);
     $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req);
     $this->assertSame($imap, $req->imap());
     $req->imap($imap);
     $this->assertSame($imap, $req->imap());
     $xml = '<?xml version="1.0"?>' . "\n" . '<TestDataSourceRequest>' . '<imap id="id" name="name" l="l" isEnabled="true" importOnly="true" host="host" port="10" ' . 'connectionType="ssl" username="******" password="******" pollingInterval="pollingInterval" ' . 'emailAddress="emailAddress" useAddressForForwardReply="true" defaultSignature="defaultSignature" ' . 'forwardReplySignature="forwardReplySignature" fromDisplay="fromDisplay" replyToAddress="replyToAddress" ' . 'replyToDisplay="replyToDisplay" importClass="importClass" failingSince="10">' . '<lastError>lastError</lastError>' . '<a>a</a>' . '<a>b</a>' . '</imap>' . '</TestDataSourceRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = array('TestDataSourceRequest' => array('_jsns' => 'urn:zimbraMail', 'imap' => array('id' => 'id', 'name' => 'name', 'l' => 'l', 'isEnabled' => true, 'importOnly' => true, 'host' => 'host', 'port' => 10, 'connectionType' => 'ssl', 'username' => 'username', 'password' => 'password', 'pollingInterval' => 'pollingInterval', 'emailAddress' => 'emailAddress', 'useAddressForForwardReply' => true, 'defaultSignature' => 'defaultSignature', 'forwardReplySignature' => 'forwardReplySignature', 'fromDisplay' => 'fromDisplay', 'replyToAddress' => 'replyToAddress', 'replyToDisplay' => 'replyToDisplay', 'importClass' => 'importClass', 'failingSince' => 10, 'lastError' => 'lastError', 'a' => array('a', 'b'))));
     $this->assertEquals($array, $req->toArray());
 }