public function testSearch() { $header = new \Zimbra\Struct\AttributeName('attribute-name'); $tz = $this->getTz(); $cursor = new \Zimbra\Struct\CursorInfo('id', 'sortVal', 'endSortVal', true); $this->_api->search(true, 'query', array($header), $tz, 'locale', $cursor, true, true, 'allowableTaskStatus', 10, 10, true, 'types', 'groupBy', true, SortBy::DATE_DESC(), 'fetch', true, 10, true, true, true, true, true, 'resultMode', 'field', 10, 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:SearchRequest warmup="true" includeTagDeleted="true" includeTagMuted="true" allowableTaskStatus="allowableTaskStatus" calExpandInstStart="10" calExpandInstEnd="10" inDumpster="true" types="types" groupBy="groupBy" quick="true" sortBy="dateDesc" fetch="fetch" read="true" max="10" html="true" needExp="true" neuter="true" recip="true" prefetch="true" resultMode="resultMode" field="field" limit="10" offset="10">' . '<urn1:query>query</urn1:query>' . '<urn1:tz id="id" stdoff="10" dayoff="10" stdname="stdname" dayname="dayname">' . '<urn1:standard mon="12" hour="2" min="3" sec="4" />' . '<urn1:daylight mon="4" hour="3" min="2" sec="10" />' . '</urn1:tz>' . '<urn1:locale>locale</urn1:locale>' . '<urn1:cursor id="id" sortVal="sortVal" endSortVal="endSortVal" includeOffset="true" />' . '<urn1:header n="attribute-name" />' . '</urn1:SearchRequest>' . '</env:Body>' . '</env:Envelope>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); }
public function testSearch() { $header = new \Zimbra\Struct\AttributeName('attribute-name'); $tz = $this->getTz(); $cursor = new \Zimbra\Struct\CursorInfo('id', 'sortVal', 'endSortVal', true); $req = new \Zimbra\Mail\Request\Search(true, 'query', array($header), $tz, 'locale', $cursor, true, true, 'allowableTaskStatus', 10, 10, true, 'types', 'groupBy', true, SortBy::DATE_DESC(), 'fetch', true, 10, true, true, true, true, true, 'resultMode', 'field', 10, 10); $this->assertInstanceOf('Zimbra\\Mail\\Request\\MailSearchParams', $req); $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req); $this->assertTrue($req->warmup()); $req->warmup(true); $this->assertTrue($req->warmup()); $xml = '<?xml version="1.0"?>' . "\n" . '<SearchRequest warmup="true" includeTagDeleted="true" includeTagMuted="true" allowableTaskStatus="allowableTaskStatus" calExpandInstStart="10" calExpandInstEnd="10" inDumpster="true" types="types" groupBy="groupBy" quick="true" sortBy="dateDesc" fetch="fetch" read="true" max="10" html="true" needExp="true" neuter="true" recip="true" prefetch="true" resultMode="resultMode" field="field" limit="10" offset="10">' . '<query>query</query>' . '<tz id="id" stdoff="10" dayoff="10" stdname="stdname" dayname="dayname">' . '<standard mon="12" hour="2" min="3" sec="4" />' . '<daylight mon="4" hour="3" min="2" sec="10" />' . '</tz>' . '<locale>locale</locale>' . '<cursor id="id" sortVal="sortVal" endSortVal="endSortVal" includeOffset="true" />' . '<header n="attribute-name" />' . '</SearchRequest>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); $array = array('SearchRequest' => array('_jsns' => 'urn:zimbraMail', 'query' => 'query', 'header' => array(array('n' => 'attribute-name')), 'tz' => array('id' => 'id', 'stdoff' => 10, 'dayoff' => 10, 'stdname' => 'stdname', 'dayname' => 'dayname', 'standard' => array('mon' => 12, 'hour' => 2, 'min' => 3, 'sec' => 4), 'daylight' => array('mon' => 4, 'hour' => 3, 'min' => 2, 'sec' => 10)), 'locale' => 'locale', 'cursor' => array('id' => 'id', 'sortVal' => 'sortVal', 'endSortVal' => 'endSortVal', 'includeOffset' => true), 'warmup' => true, 'includeTagDeleted' => true, 'includeTagMuted' => true, 'allowableTaskStatus' => 'allowableTaskStatus', 'calExpandInstStart' => 10, 'calExpandInstEnd' => 10, 'inDumpster' => true, 'types' => 'types', 'groupBy' => 'groupBy', 'quick' => true, 'sortBy' => 'dateDesc', 'fetch' => 'fetch', 'read' => true, 'max' => 10, 'html' => true, 'needExp' => true, 'neuter' => true, 'recip' => true, 'prefetch' => true, 'resultMode' => 'resultMode', 'field' => 'field', 'limit' => 10, 'offset' => 10)); $this->assertEquals($array, $req->toArray()); }