public function testCompactIndexApi() { $id = $this->faker->word; $mbox = new MailboxByAccountIdSelector($id); $this->api->compactIndex($mbox, IndexAction::STATUS()); $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:zimbraAdmin">' . '<env:Body>' . '<urn1:CompactIndexRequest action="status">' . '<urn1:mbox id="' . $id . '" />' . '</urn1:CompactIndexRequest>' . '</env:Body>' . '</env:Envelope>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); }
public function testCompactIndexAction() { $values = array('start', 'status'); foreach ($values as $value) { $this->assertTrue(\Zimbra\Enum\CompactIndexAction::has($value)); } }
public function testCompactIndex() { $id = self::randomName(); $mbox = new \Zimbra\Admin\Struct\MailboxByAccountIdSelector($id); $req = new \Zimbra\Admin\Request\CompactIndex($mbox, IndexAction::START()); $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req); $this->assertSame($mbox, $req->getMailbox()); $this->assertSame('start', $req->getAction()->value()); $req->setMailbox($mbox)->setAction(IndexAction::STATUS()); $this->assertSame($mbox, $req->getMailbox()); $this->assertSame('status', $req->getAction()->value()); $xml = '<?xml version="1.0"?>' . "\n" . '<CompactIndexRequest action="' . IndexAction::STATUS() . '">' . '<mbox id="' . $id . '" />' . '</CompactIndexRequest>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); $array = ['CompactIndexRequest' => ['_jsns' => 'urn:zimbraAdmin', 'action' => IndexAction::STATUS()->value(), 'mbox' => ['id' => $id]]]; $this->assertEquals($array, $req->toArray()); }