@@ -938,70 +938,15 @@ public function testRemoveAllDocuments(): void
938938 'deleted ' => true ,
939939 ],
940940 ]);
941- // Third response, listing out the documents that are available after our delete request. We'll return some
942- // more items to be deleted (testing that the loop functions)
943- $ bodyThree = json_encode ([
944- 'meta ' => [
945- 'page ' => [
946- 'current ' => 1 ,
947- // Two pages of results, 3 here, and then we'll have 2 more later
948- 'total_pages ' => 2 ,
949- // Total of 4 documents, 3 of which are presented now
950- 'total_results ' => 5 ,
951- 'size ' => 3 ,
952- ],
953- ],
954- 'results ' => [
955- [
956- 'id ' => 'doc1 ' ,
957- 'record_id ' => '1 ' ,
958- ],
959- [
960- 'id ' => 'doc2 ' ,
961- 'record_id ' => '2 ' ,
962- ],
963- [
964- 'id ' => 'doc3 ' ,
965- 'record_id ' => '3 ' ,
966- ],
967- ],
968- ]);
969- // Fourth response is from the second delete request
970- $ bodyFour = json_encode ([
971- [
972- 'id ' => 'doc4 ' ,
973- 'deleted ' => true ,
974- ],
975- [
976- 'id ' => 'doc5 ' ,
977- 'deleted ' => true ,
978- ],
979- ]);
980- // Fifth (and final) response is for when we request available documents after our second delete request. We'll
981- // return no results here, indicating that everything has been deleted
982- $ bodyFive = json_encode ([
983- 'meta ' => [
984- 'page ' => [
985- 'current ' => 1 ,
986- 'total_pages ' => 1 ,
987- 'total_results ' => 0 ,
988- 'size ' => 100 ,
989- ],
990- ],
991- 'results ' => [],
992- ]);
993941
994942 // Append our mocks
995943 $ this ->mock ->append (new Response (200 , $ headers , $ bodyOne ));
996944 $ this ->mock ->append (new Response (200 , $ headers , $ bodyTwo ));
997- $ this ->mock ->append (new Response (200 , $ headers , $ bodyThree ));
998- $ this ->mock ->append (new Response (200 , $ headers , $ bodyFour ));
999- $ this ->mock ->append (new Response (200 , $ headers , $ bodyFive ));
1000945
1001- $ numRemoved = $ this ->searchService ->removeAllDocuments ('content ' );
946+ $ numRemoved = $ this ->searchService ->clearIndexDocuments ('content ' , 5 );
1002947
1003- // A total of 5 documents were requested to be removed, but only 4 returned deleted = true
1004- $ this ->assertEqualsCanonicalizing (4 , $ numRemoved );
948+ // A total of 3 documents were requested to be removed, but only 2 returned deleted = true
949+ $ this ->assertEqualsCanonicalizing (2 , $ numRemoved );
1005950 // And make sure nothing is left in our Response Stack. This would indicate that every Request we expect to make
1006951 // has been made
1007952 $ this ->assertEquals (0 , $ this ->mock ->count ());
0 commit comments