Skip to content

Commit

Permalink
deleteDocument not return boolean as a result.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nexucis committed Oct 21, 2017
1 parent f512aa7 commit f976c13
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/Nexucis/Elasticsearch/Helper/Nodowntime/IndexHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ public function deleteAllDocuments($alias)
* @param $alias [REQUIRED]
* @param $id [REQUIRED]
* @param string $type [REQUIRED]
* @return boolean
* @return void
* @throws IndexNotFoundException
*/
public function deleteDocument($alias, $id, $type)
Expand All @@ -513,8 +513,7 @@ public function deleteDocument($alias, $id, $type)
'id' => $id,
);

$response = $this->client->delete($params);
return $response['found'] > 0;
$this->client->delete($params);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function deleteAllDocuments($alias);
* @param $alias [REQUIRED]
* @param $id [REQUIRED]
* @param string $type [REQUIRED]
* @return bool
* @return void
* @throws IndexNotFoundException
*/
public function deleteDocument($alias, $id, $type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,19 @@ public function testDeleteDocument($alias)

$this->assertTrue(self::$HELPER->addDocument($alias, $type, $body, $id));

$this->assertTrue(self::$HELPER->deleteDocument($alias, $id, $type));
self::$HELPER->deleteDocument($alias, $id, $type);
}

/**
* @dataProvider aliasDataProvider
* @expectedException \Elasticsearch\Common\Exceptions\Missing404Exception
*/
public function testDocumentNotExist($alias)
{
$type = 'test';
$id = 0;
self::$HELPER->createIndex($alias);
$this->assertFalse(self::$HELPER->deleteDocument($alias, $id, $type));
self::$HELPER->deleteDocument($alias, $id, $type);
}

/**
Expand Down

0 comments on commit f976c13

Please sign in to comment.