This repository was archived by the owner on Dec 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ public function finish(FinishStatus $status = FinishStatus::Success): void
201
201
202
202
// Now finally delete itself.
203
203
204
- if (config ('haystack.delete_finished_haystacks ' ) === true ) {
204
+ if ($ status === FinishStatus::Success && config ('haystack.delete_finished_haystacks ' ) === true ) {
205
205
$ this ->delete ();
206
206
}
207
207
}
Original file line number Diff line number Diff line change 4
4
5
5
use Illuminate \Support \Carbon ;
6
6
7
+ use function Pest \Laravel \assertModelExists ;
7
8
use function Pest \Laravel \travel ;
8
9
9
10
use Illuminate \Support \Collection ;
439
440
440
441
expect (cache ()->get ('failed ' ))->toBeTrue ();
441
442
442
- assertModelMissing ($ haystack );
443
+ assertModelExists ($ haystack ); // Should still exist
443
444
});
444
445
445
446
test ('the haystack will fail if the job is manually failed ' , function () {
458
459
459
460
expect (cache ()->get ('failed ' ))->toBeTrue ();
460
461
461
- assertModelMissing ($ haystack );
462
+ assertModelExists ($ haystack ); // Should still exist
462
463
});
463
464
464
465
test ('a haystack can be cancelled early and future jobs wont be processed ' , function () {
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ function myFunction()
176
176
expect (Haystack::all ())->toHaveCount (0 );
177
177
});
178
178
179
- test ('when a haystack fails it will delete itself and all bales ' , function () {
179
+ test ('when a haystack fails it will remain with the final bales ' , function () {
180
180
$ haystack = Haystack::factory ()
181
181
->has (HaystackBale::factory ()->state (['job ' => new NameJob ('Sam ' )]), 'bales ' )
182
182
->create ();
@@ -186,8 +186,8 @@ function myFunction()
186
186
187
187
$ haystack ->fail ();
188
188
189
- expect (Haystack::all ())->toHaveCount (0 );
190
- expect (HaystackBale::all ())->toHaveCount (0 );
189
+ expect (Haystack::all ())->toHaveCount (1 );
190
+ expect (HaystackBale::all ())->toHaveCount (1 );
191
191
});
192
192
193
193
test ('you can instantiate a haystack builder from the model ' , function () {
You can’t perform that action at this time.
0 commit comments