Skip to content

Commit

Permalink
Prepare 5.3.2 release (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin authored May 29, 2018
1 parent 5e3656e commit 4b6cfe8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Change Log
All notable changes to this project will be documented in this file based on the [Keep a Changelog](http://keepachangelog.com/) Standard. This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased](https://github.com/ruflin/Elastica/compare/5.3.1...master)
## [Unreleased](https://github.com/ruflin/Elastica/compare/5.3.2...master)

### Backward Compatibility Breaks

### Bugfixes

### Added

### Improvements


## [Unreleased](https://github.com/ruflin/Elastica/compare/5.3.1...5.3.2)

### Bugfixes
- Remove [`each()`](http://www.php.net/each) usage to fix PHP 7.2 compatibility
- Fix [#1435](https://github.com/ruflin/Elastica/issues/1435) forcing `doc_as_upsert` to be boolean, acording [Elastic doc-update documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_literal_doc_as_upsert_literal)
Expand All @@ -13,8 +22,6 @@ All notable changes to this project will be documented in this file based on the

* Added support for multiple bucket sort orders for aggregations.

### Improvements


## [5.3.1](https://github.com/ruflin/Elastica/compare/5.3.0...5.3.1)

Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Bulk/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function toString()
$string .= $source;
} elseif (is_array($source) && array_key_exists('doc', $source) && is_string($source['doc'])) {
if (isset($source['doc_as_upsert'])) {
$docAsUpsert = ', "doc_as_upsert": ' . ($source['doc_as_upsert'] ? 'true' : 'false' );
$docAsUpsert = ', "doc_as_upsert": '.($source['doc_as_upsert'] ? 'true' : 'false');
} else {
$docAsUpsert = '';
}
Expand Down
9 changes: 4 additions & 5 deletions test/Elastica/Bulk/Action/UpdateDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
namespace Elastica\Test\BulkAction;

use Elastica\Bulk\Action\UpdateDocument;
use Elastica\Document;
use Elastica\Index;
use Elastica\Test\Base as BaseTest;
use Elastica\Type;
use Elastica\Document;

class ActionTest extends BaseTest
class UpdateDocumentTest extends BaseTest
{
/**
* @group unit
Expand Down Expand Up @@ -61,7 +61,6 @@ public function testUpdateDocument()
$expected = '{"update":{"_index":"index2","_type":"type2","_id":1,"_routing":1}}'."\n";
$expected .= $docExpected;
$this->assertEquals($expected, $action->toString());

}

/**
Expand All @@ -77,7 +76,7 @@ public function testUpdateDocumentAsUpsert()
$this->assertTrue($action->hasSource());

$expected = '{"update":{"_index":"index","_type":"type","_id":1}}'."\n"
. '{"doc":{"foo":"bar"},"doc_as_upsert":true}'."\n";
.'{"doc":{"foo":"bar"},"doc_as_upsert":true}'."\n";
$this->assertEquals($expected, $action->toString());

$document->setDocAsUpsert(1);
Expand All @@ -87,7 +86,7 @@ public function testUpdateDocumentAsUpsert()
$document->setDocAsUpsert(false);
$action->setDocument($document);
$expected = '{"update":{"_index":"index","_type":"type","_id":1}}'."\n"
. '{"doc":{"foo":"bar"}}'."\n";
.'{"doc":{"foo":"bar"}}'."\n";
$this->assertEquals($expected, $action->toString());

$document->setDocAsUpsert(0);
Expand Down
4 changes: 3 additions & 1 deletion test/Elastica/BulkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ public function testUpsert()
$doc2 = $type->createDocument(2, ['name' => 'Beckenbauer']);
$doc3 = $type->createDocument(3, ['name' => 'Baggio']);
$doc4 = $type->createDocument(4, ['name' => 'Cruyff']);
$documents = array_map(function($d){ $d->setDocAsUpsert(true); return $d;}, [$doc1, $doc2, $doc3, $doc4]);
$documents = array_map(function ($d) { $d->setDocAsUpsert(true);

return $d;}, [$doc1, $doc2, $doc3, $doc4]);

//index some documents
$bulk = new Bulk($client);
Expand Down

0 comments on commit 4b6cfe8

Please sign in to comment.