コード例 #1
0
ファイル: ReIndexTest.php プロジェクト: zimbra-api/admin
 public function testReIndexApi()
 {
     $id = $this->faker->word;
     $ids = $this->faker->word;
     $enums = $this->faker->randomElements(ReindexType::enums(), mt_rand(1, count(ReindexType::enums())));
     $types = implode(',', $enums);
     $mbox = new ReindexMailboxInfo($id, $types, $ids);
     $this->api->reIndex($mbox, ReIndexAction::CANCEL());
     $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:ReIndexRequest action="' . ReIndexAction::CANCEL() . '">' . '<urn1:mbox id="' . $id . '" types="' . $types . '" ids="' . $ids . '" />' . '</urn1:ReIndexRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
コード例 #2
0
ファイル: ApiTest.php プロジェクト: nucleus-be/zimbra-api
 public function testReIndex()
 {
     $id = self::randomName();
     $ids = self::randomName();
     $types = self::randomAttrs(\Zimbra\Enum\ReindexType::enums());
     $mbox = new \Zimbra\Admin\Struct\ReindexMailboxInfo($id, $types, $ids);
     $this->_api->reIndex($mbox, ReIndexAction::CANCEL());
     $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:zimbraAdmin">' . '<env:Body>' . '<urn1:ReIndexRequest action="' . ReIndexAction::CANCEL() . '">' . '<urn1:mbox id="' . $id . '" types="' . $types . '" ids="' . $ids . '" />' . '</urn1:ReIndexRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
コード例 #3
0
ファイル: EnumTest.php プロジェクト: nucleus-be/zimbra-api
 public function testReIndexAction()
 {
     $values = array('start', 'status', 'cancel');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\ReIndexAction::has($value));
     }
 }
コード例 #4
0
ファイル: RequestTest.php プロジェクト: nucleus-be/zimbra-api
 public function testReIndex()
 {
     $id = self::randomName();
     $ids = self::randomName();
     $types = self::randomAttrs(\Zimbra\Enum\ReindexType::enums());
     $mbox = new \Zimbra\Admin\Struct\ReindexMailboxInfo($id, $types, $ids);
     $req = new \Zimbra\Admin\Request\ReIndex($mbox, ReIndexAction::START());
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req);
     $this->assertEquals($mbox, $req->getMailbox());
     $this->assertEquals('start', $req->getAction()->value());
     $req->setMailbox($mbox)->setAction(ReIndexAction::CANCEL());
     $this->assertEquals($mbox, $req->getMailbox());
     $this->assertEquals('cancel', $req->getAction()->value());
     $xml = '<?xml version="1.0"?>' . "\n" . '<ReIndexRequest action="' . ReIndexAction::CANCEL() . '">' . '<mbox id="' . $id . '" types="' . $types . '" ids="' . $ids . '" />' . '</ReIndexRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['ReIndexRequest' => ['_jsns' => 'urn:zimbraAdmin', 'action' => ReIndexAction::CANCEL()->value(), 'mbox' => ['id' => $id, 'types' => $types, 'ids' => $ids]]];
     $this->assertEquals($array, $req->toArray());
 }