Пример #1
0
 public function testBrowseBy()
 {
     $values = array('domains', 'attachments', 'objects');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\BrowseBy::has($value));
     }
 }
Пример #2
0
 public function testBrowseApi()
 {
     $regex = $this->faker->word;
     $max = mt_rand(1, 10);
     $this->api->browse(BrowseBy::DOMAINS(), $regex, $max);
     $client = $this->api->getClient();
     $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:BrowseRequest browseBy="' . BrowseBy::DOMAINS() . '" regex="' . $regex . '" maxToReturn="' . $max . '" />' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Пример #3
0
 public function testBrowse()
 {
     $this->_api->browse(BrowseBy::DOMAINS(), 'regex', 10);
     $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:BrowseRequest browseBy="domains" regex="regex" maxToReturn="10" />' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Пример #4
0
 public function testBrowse()
 {
     $req = new \Zimbra\Mail\Request\Browse(BrowseBy::DOMAINS(), 'regex', 10);
     $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req);
     $this->assertTrue($req->browseBy()->is('domains'));
     $this->assertSame('regex', $req->regex());
     $this->assertSame(10, $req->maxToReturn());
     $req->browseBy(BrowseBy::DOMAINS())->regex('regex')->maxToReturn(10);
     $this->assertTrue($req->browseBy()->is('domains'));
     $this->assertSame('regex', $req->regex());
     $this->assertSame(10, $req->maxToReturn());
     $xml = '<?xml version="1.0"?>' . "\n" . '<BrowseRequest browseBy="domains" regex="regex" maxToReturn="10" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = array('BrowseRequest' => array('_jsns' => 'urn:zimbraMail', 'browseBy' => 'domains', 'regex' => 'regex', 'maxToReturn' => 10));
     $this->assertEquals($array, $req->toArray());
 }