/** * Test Facets */ public function testFacets() { $obj_doc = new \Search\Document(); $obj_doc->atomFacet('ref', '121gw'); $obj_doc->numberFacet('gw', 1.21); $obj_doc->numberFacet('gw', 2.42); $obj_doc->atomFacet('gw', 'lots'); $this->assertEquals([['name' => 'ref', 'atom' => '121gw'], ['name' => 'gw', 'number' => 1.21], ['name' => 'gw', 'number' => 2.42], ['name' => 'gw', 'atom' => 'lots']], $obj_doc->getFacets()); }
/** * Test the delete document function with a variety of inputs */ public function testDeleteMulti() { $str_index = 'test-index'; $str_id = '123456789'; $obj_request = new \google\appengine\DeleteDocumentRequest(); $obj_params = $obj_request->mutableParams(); $obj_params->mutableIndexSpec()->setName($str_index); $obj_params->addDocId($str_id); $this->apiProxyMock->expectCall('search', 'DeleteDocument', $obj_request, new \google\appengine\DeleteDocumentResponse()); $obj_index = new \Search\Index($str_index); $obj_index->delete($str_id); $this->apiProxyMock->verify(); $this->apiProxyMock->expectCall('search', 'DeleteDocument', $obj_request, new \google\appengine\DeleteDocumentResponse()); $obj_doc = new \Search\Document(); $obj_doc->setId($str_id); $obj_index->delete($obj_doc); $this->apiProxyMock->verify(); $this->apiProxyMock->expectCall('search', 'DeleteDocument', $obj_request, new \google\appengine\DeleteDocumentResponse()); $obj_doc = new \Search\Document(); $obj_doc->setId($str_id); $obj_index->delete([$obj_doc]); $this->apiProxyMock->verify(); }