Skip to content

Commit cfe02dd

Browse files
cursoragentruflin
andcommitted
test: add changelog and integer-ID coverage for Client::deleteIds
Follow up #2317 / #2316 with a changelog entry and a functional regression test that deletes a document using an integer ID. Co-authored-by: Nicolas Ruflin <ruflin@users.noreply.github.com>
1 parent 178b73f commit cfe02dd

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
### Deprecated
1717
### Removed
1818
### Fixed
19+
* `Client::deleteIds()` now accepts integer document IDs again by casting them to string before `Action::setId()` [#2316](https://github.com/ruflin/Elastica/issues/2316)
1920
### Security
2021

2122

tests/ClientFunctionalTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,27 @@ public function testDeleteIdsIdxObjectTypeObject(): void
348348
$this->assertEquals(0, $totalHits);
349349
}
350350

351+
/**
352+
* Integer IDs must be accepted by deleteIds() after strict_types made
353+
* Action::setId(string) reject implicit int-to-string coercion.
354+
*
355+
* @see https://github.com/ruflin/Elastica/issues/2316
356+
*/
357+
#[Group('functional')]
358+
public function testDeleteIdsWithIntegerIds(): void
359+
{
360+
$index = $this->_createIndex();
361+
$index->addDocument(new Document('185755', ['username' => 'hans']));
362+
$index->refresh();
363+
364+
$this->assertEquals(1, $index->search('username:hans')->getTotalHits());
365+
366+
$index->getClient()->deleteIds([185755], $index);
367+
$index->refresh();
368+
369+
$this->assertEquals(0, $index->search('username:hans')->getTotalHits());
370+
}
371+
351372
public function testOneInvalidConnection(): void
352373
{
353374
$client = $this->_getClient([

0 commit comments

Comments
 (0)