public function testCheckGalConfigRequest() { $key = $this->faker->word; $value = $this->faker->word; $limit = mt_rand(0, 100); $attr = new KeyValuePair($key, $value); $query = new LimitedQuery($limit, $value); $req = new CheckGalConfig($query, GalConfigAction::AUTOCOMPLETE(), [$attr]); $this->assertInstanceOf('Zimbra\\Admin\\Request\\BaseAttr', $req); $this->assertSame($query, $req->getQuery()); $this->assertTrue($req->getAction()->is('autocomplete')); $req->setQuery($query)->setAction(GalConfigAction::SEARCH()); $this->assertSame($query, $req->getQuery()); $this->assertTrue($req->getAction()->is('search')); $xml = '<?xml version="1.0"?>' . "\n" . '<CheckGalConfigRequest>' . '<query limit="' . $limit . '">' . $value . '</query>' . '<action>' . GalConfigAction::SEARCH() . '</action>' . '<a n="' . $key . '">' . $value . '</a>' . '</CheckGalConfigRequest>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); $array = ['CheckGalConfigRequest' => ['_jsns' => 'urn:zimbraAdmin', 'query' => ['limit' => $limit, '_content' => $value], 'action' => 'search', 'a' => [['n' => $key, '_content' => $value]]]]; $this->assertEquals($array, $req->toArray()); }