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); }
public function testReindexMailboxInfo() { $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->assertSame($id, $mbox->getId()); $this->assertSame($types, $mbox->getTypes()); $this->assertSame($ids, $mbox->getIds()); $mbox->setId($id)->setTypes($types)->setIds($ids); $this->assertSame($id, $mbox->getId()); $this->assertSame($types, $mbox->getTypes()); $this->assertSame($ids, $mbox->getIds()); $xml = '<?xml version="1.0"?>' . "\n" . '<mbox id="' . $id . '" types="' . $types . '" ids="' . $ids . '" />'; $this->assertXmlStringEqualsXmlString($xml, (string) $mbox); $array = ['mbox' => ['id' => $id, 'types' => $types, 'ids' => $ids]]; $this->assertEquals($array, $mbox->toArray()); }
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); }
public function testReindexMailboxInfo() { $id = self::randomName(); $ids = self::randomName(); $types = self::randomAttrs(\Zimbra\Enum\ReindexType::enums()); $mbox = new \Zimbra\Admin\Struct\ReindexMailboxInfo($id, $types, $ids); $this->assertSame($id, $mbox->getId()); $this->assertSame($types, $mbox->getTypes()); $this->assertSame($ids, $mbox->getIds()); $mbox->setId($id)->setTypes($types)->setIds($ids); $this->assertSame($id, $mbox->getId()); $this->assertSame($types, $mbox->getTypes()); $this->assertSame($ids, $mbox->getIds()); $xml = '<?xml version="1.0"?>' . "\n" . '<mbox id="' . $id . '" types="' . $types . '" ids="' . $ids . '" />'; $this->assertXmlStringEqualsXmlString($xml, (string) $mbox); $array = ['mbox' => ['id' => $id, 'types' => $types, 'ids' => $ids]]; $this->assertEquals($array, $mbox->toArray()); }
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()); }