Пример #1
0
 public function testStatus()
 {
     $client = new Simples_Transport_Http();
     $results = $client->status()->execute();
     $this->assertEquals(true, $results->ok);
     $this->assertTrue(isset($results->_shards->total));
 }
Пример #2
0
 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());
 }
Пример #3
0
 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);
 }
Пример #4
0
 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()));
 }
Пример #5
0
 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);
 }