Skip to content

Commit b8aca68

Browse files
committed
Fix additional test pollution and Eloquent query builder issues
1. **EntryCustomerRepositoryTest** - Added Stache clearing in beforeEach to prevent customer data accumulation across tests 2. **EloquentQueryBuilder::whereStatusLogDate** - Fixed "Relation statusLog does not exist" error by using native Eloquent builder's whereHas instead of Statamic's overridden version which expects blueprint-based relationships
1 parent 7d1078a commit b8aca68

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/Orders/EloquentQueryBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ public function wherePaymentStatus(PaymentStatus $paymentStatus)
6767

6868
public function whereStatusLogDate(OrderStatus|PaymentStatus $status, Carbon $date)
6969
{
70-
return $this->whereHas('statusLog', function ($query) use ($status, $date) {
70+
$this->builder->whereHas('statusLog', function ($query) use ($status, $date) {
7171
return $query
7272
->where('status', $status->value)
7373
->whereDate('timestamp', $date->format('Y-m-d'));
7474
});
75+
76+
return $this;
7577
}
7678

7779
protected function columnExists(string $column): bool

tests/Customers/EntryCustomerRepositoryTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
uses(PreventsSavingStacheItemsToDisk::class);
1414

15+
beforeEach(function () {
16+
Stache::store('entries')->clear();
17+
});
18+
1519
afterEach(function () {
1620
Collection::find('customers')->queryEntries()->get()->each->delete();
1721
});

0 commit comments

Comments
 (0)