Files
Investidor-V2/tests/Feature/ExistingBusinessCompatibilityTest.php
nala 3dc7c5c649
tests / ci (push) Canceled after 0s
commit 30/9
2026-09-30 09:05:43 +02:00

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);
}
}