Skip to content

Commit 5e1f5cd

Browse files
author
Rémi Garcia
committed
added test for Engine::remove() when multiple entities are provided
1 parent 7385e33 commit 5e1f5cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/Integration/EngineTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,25 @@ public function testIndexingEmptyEntity(): void
4848
$this->assertInstanceOf(ApiException::class, $e);
4949
}
5050
}
51+
52+
public function testRemovingMultipleEntity(): void
53+
{
54+
$post1 = $this->createSearchablePost();
55+
$post2 = $this->createSearchablePost();
56+
57+
$result = $this->engine->remove([$post1, $post2]);
58+
59+
$this->assertArrayHasKey('sf_phpunit__posts', $result);
60+
$this->assertCount(2, $result['sf_phpunit__posts']);
61+
62+
$this->waitForAllTasks();
63+
64+
foreach ([$post1, $post2] as $post) {
65+
$searchResult = $this->engine->search('', $post->getIndexUid(), []);
66+
67+
$this->assertArrayHasKey('hits', $searchResult);
68+
$this->assertIsArray($searchResult['hits']);
69+
$this->assertEmpty($searchResult['hits']);
70+
}
71+
}
5172
}

0 commit comments

Comments
 (0)