08d51eb6c8
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use App\Services\DaData\Dto\PartyLookupResult;
|
|
use App\Services\DaData\PartyLookup;
|
|
|
|
it('lookup-inn returns found:false when party lookup is null (default Null driver)', function () {
|
|
$tenant = Tenant::factory()->create();
|
|
$this->actingAs(User::factory()->create(['tenant_id' => $tenant->id]));
|
|
|
|
$this->postJson('/api/tenant/requisites/lookup-inn', ['inn' => '7707083893'])
|
|
->assertOk()
|
|
->assertJson(['found' => false]);
|
|
});
|
|
|
|
it('lookup-inn returns found:true with a fake lookup', function () {
|
|
$tenant = Tenant::factory()->create();
|
|
$this->actingAs(User::factory()->create(['tenant_id' => $tenant->id]));
|
|
|
|
$this->app->bind(PartyLookup::class, fn () => new class implements PartyLookup
|
|
{
|
|
public function findByInn(string $inn): ?PartyLookupResult
|
|
{
|
|
return new PartyLookupResult('ООО Тест', '770101001', '1027700132195', 'Москва', 'LEGAL', []);
|
|
}
|
|
});
|
|
|
|
$this->postJson('/api/tenant/requisites/lookup-inn', ['inn' => '7707083893'])
|
|
->assertOk()
|
|
->assertJson([
|
|
'found' => true,
|
|
'legal_name' => 'ООО Тест',
|
|
'subject_type_hint' => 'legal_entity',
|
|
]);
|
|
});
|