30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\User;
|
|
use App\Services\ExistingBusinessDrafts;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Queue;
|
|
use Tests\TestCase;
|
|
|
|
class ExistingBusinessCompatibilityTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_shadow_unavailability_does_not_change_private_contract_or_authorization(): void
|
|
{
|
|
config(['existing-business.enabled' => true, 'existing-business.compatibility_shadow' => true]);
|
|
Queue::fake();
|
|
$owner = User::factory()->create();
|
|
$other = User::factory()->create();
|
|
$business = app(ExistingBusinessDrafts::class)->save($owner, ['modality' => 'company_sale',
|
|
'classification' => 'confidential', 'reason' => 'Synthetic compatibility case', 'payload' => ['title' => 'Reserved synthetic title']]);
|
|
$url = '/api/v1/existing-business/listings/'.$business->id;
|
|
$this->actingAs($owner)->getJson($url)->assertOk()->assertJsonPath('record.payload.title', 'Reserved synthetic title');
|
|
$this->actingAs($other)->getJson($url)->assertForbidden();
|
|
Queue::assertNothingPushed();
|
|
$this->assertDatabaseCount('existing_business_revisions', 1);
|
|
}
|
|
}
|