Changeset View
Changeset View
Standalone View
Standalone View
src/tests/TestCase.php
Show All 15 Lines | abstract class TestCase extends BaseTestCase | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
// Disable throttling | // Disable throttling | ||||
$this->withoutMiddleware(ThrottleRequests::class); | $this->withoutMiddleware(ThrottleRequests::class); | ||||
} | } | ||||
protected function backdateEntitlements($entitlements, $targetDate) | protected function backdateEntitlements($entitlements, $targetDate, $targetCreatedDate = null) | ||||
{ | { | ||||
$wallets = []; | $wallets = []; | ||||
$ids = []; | $ids = []; | ||||
foreach ($entitlements as $entitlement) { | foreach ($entitlements as $entitlement) { | ||||
$ids[] = $entitlement->id; | $ids[] = $entitlement->id; | ||||
$wallets[] = $entitlement->wallet_id; | $wallets[] = $entitlement->wallet_id; | ||||
} | } | ||||
\App\Entitlement::whereIn('id', $ids)->update([ | \App\Entitlement::whereIn('id', $ids)->update([ | ||||
'created_at' => $targetDate, | 'created_at' => $targetCreatedDate ?: $targetDate, | ||||
'updated_at' => $targetDate, | 'updated_at' => $targetDate, | ||||
]); | ]); | ||||
if (!empty($wallets)) { | if (!empty($wallets)) { | ||||
$wallets = array_unique($wallets); | $wallets = array_unique($wallets); | ||||
$owners = \App\Wallet::whereIn('id', $wallets)->pluck('user_id')->all(); | $owners = \App\Wallet::whereIn('id', $wallets)->pluck('user_id')->all(); | ||||
\App\User::whereIn('id', $owners)->update(['created_at' => $targetDate]); | \App\User::whereIn('id', $owners)->update([ | ||||
'created_at' => $targetCreatedDate ?: $targetDate | |||||
]); | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Set baseURL to the admin UI location | * Set baseURL to the admin UI location | ||||
*/ | */ | ||||
protected static function useAdminUrl(): void | protected static function useAdminUrl(): void | ||||
{ | { | ||||
Show All 19 Lines |