Ejemplo n.º 1
0
 public function testReIndexRequest()
 {
     $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);
     $req = new 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());
 }
Ejemplo n.º 2
0
 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());
 }