@@ -3963,13 +3963,33 @@ public function testDeleteBulkDocuments(): void
39633963 Query::orderAsc (),
39643964 Query::limit (2 ),
39653965 ],
3966- batchSize: 1
3966+ batchSize: 1 ,
3967+ onNext: function () {
3968+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
3969+ },
3970+ onError:function ($ e ) {
3971+ if ($ e instanceof Exception) {
3972+ $ this ->assertInstanceOf (Exception::class, $ e );
3973+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
3974+ } else {
3975+ $ this ->fail ("Caught value is not an Exception. " );
3976+ }
3977+ }
39673978 );
39683979
39693980 $ this ->assertEquals (2 , $ count );
39703981
39713982 // TEST: Bulk Delete All Documents
3972- $ this ->assertEquals (8 , $ database ->deleteDocuments ('bulk_delete ' ));
3983+ $ this ->assertEquals (8 , $ database ->deleteDocuments ('bulk_delete ' , onNext: function () {
3984+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
3985+ }, onError:function ($ e ) {
3986+ if ($ e instanceof Exception) {
3987+ $ this ->assertInstanceOf (Exception::class, $ e );
3988+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
3989+ } else {
3990+ $ this ->fail ("Caught value is not an Exception. " );
3991+ }
3992+ }));
39733993
39743994 $ docs = $ database ->find ('bulk_delete ' );
39753995 $ this ->assertCount (0 , $ docs );
@@ -3982,6 +4002,14 @@ public function testDeleteBulkDocuments(): void
39824002 Query::greaterThanEqual ('integer ' , 5 )
39834003 ], onNext: function ($ doc ) use (&$ results ) {
39844004 $ results [] = $ doc ;
4005+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
4006+ }, onError:function ($ e ) {
4007+ if ($ e instanceof Exception) {
4008+ $ this ->assertInstanceOf (Exception::class, $ e );
4009+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
4010+ } else {
4011+ $ this ->fail ("Caught value is not an Exception. " );
4012+ }
39854013 });
39864014
39874015 $ this ->assertEquals (5 , $ count );
@@ -3998,7 +4026,16 @@ public function testDeleteBulkDocuments(): void
39984026
39994027 try {
40004028 $ this ->getDatabase ()->withRequestTimestamp ($ oneHourAgo , function () {
4001- return $ this ->getDatabase ()->deleteDocuments ('bulk_delete ' );
4029+ return $ this ->getDatabase ()->deleteDocuments ('bulk_delete ' , onNext: function () {
4030+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
4031+ }, onError:function ($ e ) {
4032+ if ($ e instanceof Exception) {
4033+ $ this ->assertInstanceOf (Exception::class, $ e );
4034+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
4035+ } else {
4036+ $ this ->fail ("Caught value is not an Exception. " );
4037+ }
4038+ });
40024039 });
40034040 $ this ->fail ('Failed to throw exception ' );
40044041 } catch (ConflictException $ e ) {
@@ -4042,7 +4079,16 @@ public function testDeleteBulkDocuments(): void
40424079 Permission::delete (Role::any ())
40434080 ], false );
40444081
4045- $ database ->deleteDocuments ('bulk_delete ' );
4082+ $ database ->deleteDocuments ('bulk_delete ' , onNext: function () {
4083+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
4084+ }, onError:function ($ e ) {
4085+ if ($ e instanceof Exception) {
4086+ $ this ->assertInstanceOf (Exception::class, $ e );
4087+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
4088+ } else {
4089+ $ this ->fail ("Caught value is not an Exception. " );
4090+ }
4091+ });
40464092
40474093 $ this ->assertEquals (0 , \count ($ this ->getDatabase ()->find ('bulk_delete ' )));
40484094
@@ -4087,10 +4133,28 @@ public function testDeleteBulkDocumentsQueries(): void
40874133 // Test limit
40884134 $ this ->propagateBulkDocuments ('bulk_delete_queries ' );
40894135
4090- $ this ->assertEquals (5 , $ database ->deleteDocuments ('bulk_delete_queries ' , [Query::limit (5 )]));
4136+ $ this ->assertEquals (5 , $ database ->deleteDocuments ('bulk_delete_queries ' , [Query::limit (5 )], onNext: function () {
4137+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
4138+ }, onError:function ($ e ) {
4139+ if ($ e instanceof Exception) {
4140+ $ this ->assertInstanceOf (Exception::class, $ e );
4141+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
4142+ } else {
4143+ $ this ->fail ("Caught value is not an Exception. " );
4144+ }
4145+ }));
40914146 $ this ->assertEquals (5 , \count ($ database ->find ('bulk_delete_queries ' )));
40924147
4093- $ this ->assertEquals (5 , $ database ->deleteDocuments ('bulk_delete_queries ' , [Query::limit (5 )]));
4148+ $ this ->assertEquals (5 , $ database ->deleteDocuments ('bulk_delete_queries ' , [Query::limit (5 )], onNext: function () {
4149+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
4150+ }, onError:function ($ e ) {
4151+ if ($ e instanceof Exception) {
4152+ $ this ->assertInstanceOf (Exception::class, $ e );
4153+ $ this ->assertEquals ("Error thrown to test update doesn't stopped and error is caught " , $ e ->getMessage ());
4154+ } else {
4155+ $ this ->fail ("Caught value is not an Exception. " );
4156+ }
4157+ }));
40944158 $ this ->assertEquals (0 , \count ($ database ->find ('bulk_delete_queries ' )));
40954159
40964160 // Test Limit more than batchSize
0 commit comments