feat: disable custom script for trial users (#371)
* feat: disable custom script for trial users * fix: logic error for trial users --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -179,6 +179,21 @@ trait TestHelpers
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function createTrialingUser()
|
||||
{
|
||||
$user = $this->createUser();
|
||||
$user->subscriptions()->create([
|
||||
'name' => 'default',
|
||||
'stripe_id' => Str::random(),
|
||||
'stripe_status' => 'trialing',
|
||||
'stripe_price' => Str::random(),
|
||||
'trial_ends_at' => now()->addDays(5),
|
||||
'quantity' => 1,
|
||||
]);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function actingAsUser(?User $user = null)
|
||||
{
|
||||
if ($user == null) {
|
||||
@@ -207,6 +222,15 @@ trait TestHelpers
|
||||
return $this->actingAsUser($user);
|
||||
}
|
||||
|
||||
public function actingAsTrialingUser(User $user = null)
|
||||
{
|
||||
if ($user == null) {
|
||||
$user = $this->createTrialingUser();
|
||||
}
|
||||
|
||||
return $this->actingAsUser($user);
|
||||
}
|
||||
|
||||
public function actingAsGuest()
|
||||
{
|
||||
if (Auth::check()) {
|
||||
|
||||
Reference in New Issue
Block a user