public function testStatus() { $client = new Simples_Transport_Http(); $results = $client->status()->execute(); $this->assertEquals(true, $results->ok); $this->assertTrue(isset($results->_shards->total)); }
public function testDelete() { $client = new Simples_Transport_Http(); $request = $client->deleteIndex('twitter'); $this->assertEquals(Simples_Request::DELETE, $request->method()); $this->assertEquals('/twitter/', (string) $request->path()); }
public function testDelete() { $client = new Simples_Transport_Http(); $this->assertTrue($client->index(array('content' => 'Pliz, pliz, delete me !'), array('index' => 'twitter', 'type' => 'tweet', 'id' => 'test_get'))->ok); $delete_object = $client->delete(1, array('index' => 'twitter', 'type' => 'tweet')); $this->assertEquals('/twitter/tweet/1/', (string) $delete_object->path()); $this->assertEquals(true, $delete_object->ok); $res = $client->get(1, array('index' => 'twitter', 'type' => 'tweet')); $this->assertFalse($res->exists); }
public function testMultiple() { $client = new Simples_Transport_Http(array('index' => 'twitter', 'type' => 'tweet')); $client->index(array(array('id' => '1', 'value' => 'first'), array('id' => '2', 'value' => 'second')), array('refresh' => true)); $request = $client->get(array(1, 2)); $this->assertEquals('/_mget/', (string) $request->path()); $body = $request->body(); $this->assertEquals('1', $body['docs'][0]['_id']); $res = $request->execute(); $this->assertEquals(2, count($res->documents())); }
public function testMagicCall() { $transport = new Simples_Transport_Http(); $status = $transport->status(); $this->assertTrue($status instanceof Simples_Request_Status); $response = $transport->status()->execute(); $this->assertTrue($response instanceof Simples_Response); }