updated deployer code
This commit is contained in:
@@ -4,6 +4,8 @@ namespace Tests\Feature;
|
||||
|
||||
use App\Models\License;
|
||||
use App\Models\LicenseProduct;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use App\Services\Payments\PurchaseProvisioner;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
@@ -47,6 +49,39 @@ class PaddleSubscriptionProvisioningTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function test_new_paddle_customer_gets_a_portal_account(): void
|
||||
{
|
||||
Notification::fake();
|
||||
$this->product('pri_personal_monthly', 'Personal', 1);
|
||||
|
||||
app(PurchaseProvisioner::class)->provision('paddle', $this->subscription(
|
||||
'subscription.created', 'active', 'pri_personal_monthly', 'pro_personal'
|
||||
));
|
||||
|
||||
$user = User::where('email', 'mark@example.com')->firstOrFail();
|
||||
$this->assertSame('Mark', $user->name);
|
||||
$this->assertNotNull($user->email_verified_at);
|
||||
}
|
||||
|
||||
public function test_existing_customer_account_is_reused(): void
|
||||
{
|
||||
Notification::fake();
|
||||
$existing = User::create([
|
||||
'email' => 'mark@example.com',
|
||||
'name' => 'Existing Mark',
|
||||
'password' => 'ExistingPassword123!',
|
||||
'email_verified_at' => now(),
|
||||
]);
|
||||
$this->product('pri_personal_monthly', 'Personal', 1);
|
||||
|
||||
app(PurchaseProvisioner::class)->provision('paddle', $this->subscription(
|
||||
'subscription.created', 'active', 'pri_personal_monthly', 'pro_personal'
|
||||
));
|
||||
|
||||
$this->assertSame(1, User::where('email', 'mark@example.com')->count());
|
||||
$this->assertSame($existing->id, User::where('email', 'mark@example.com')->firstOrFail()->id);
|
||||
}
|
||||
|
||||
public function test_trialing_subscription_issues_a_usable_license(): void
|
||||
{
|
||||
$this->product('pri_personal_monthly', 'Personal', 1);
|
||||
|
||||
Reference in New Issue
Block a user