diff --git a/CHANGELOG.md b/CHANGELOG.md index b85d8d446d..be12d358a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) @@ -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) diff --git a/lib/Elastica/Bulk/Action.php b/lib/Elastica/Bulk/Action.php index c4292100e8..53b62e1da9 100644 --- a/lib/Elastica/Bulk/Action.php +++ b/lib/Elastica/Bulk/Action.php @@ -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 = ''; } diff --git a/test/Elastica/Bulk/Action/UpdateDocumentTest.php b/test/Elastica/Bulk/Action/UpdateDocumentTest.php index 378b54d0f7..df1a068b0b 100644 --- a/test/Elastica/Bulk/Action/UpdateDocumentTest.php +++ b/test/Elastica/Bulk/Action/UpdateDocumentTest.php @@ -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 @@ -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()); - } /** @@ -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); @@ -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); diff --git a/test/Elastica/BulkTest.php b/test/Elastica/BulkTest.php index 2cb24a8e1a..71962a469e 100644 --- a/test/Elastica/BulkTest.php +++ b/test/Elastica/BulkTest.php @@ -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);