32 lines
913 B
PHP
32 lines
913 B
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Models\Package;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class PackageLemonSqueezyLinkTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_link_lemonsqueezy_ids_updates_fields(): void
|
|
{
|
|
$package = Package::factory()->create([
|
|
'lemonsqueezy_product_id' => null,
|
|
'lemonsqueezy_variant_id' => null,
|
|
'lemonsqueezy_sync_status' => null,
|
|
'lemonsqueezy_synced_at' => null,
|
|
]);
|
|
|
|
$package->linkLemonSqueezyIds('pro_123', 'pri_123');
|
|
|
|
$package->refresh();
|
|
|
|
$this->assertSame('pro_123', $package->lemonsqueezy_product_id);
|
|
$this->assertSame('pri_123', $package->lemonsqueezy_variant_id);
|
|
$this->assertSame('linked', $package->lemonsqueezy_sync_status);
|
|
$this->assertNotNull($package->lemonsqueezy_synced_at);
|
|
}
|
|
}
|