vrsao 2
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-08 14:02:01 +02:00
parent bdd766c68a
commit 1106509116
354 changed files with 48275 additions and 24635 deletions
+16 -10
View File
@@ -7,8 +7,8 @@ use App\Models\Opportunity;
use App\Models\Sector;
use App\Models\User;
use App\Services\Malware\MalwareScanner;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Database\QueryException;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
@@ -42,7 +42,7 @@ class PortalServicesTest extends TestCase
public function test_public_sections_render_and_desk_requires_login(): void
{
foreach (['sectores', 'como-investir', 'legislacao', 'documentos', 'apoio', 'parcerias', 'simulador-fiscal', 'Simulador', 'formularios/investidor', 'formularios/empresa'] as $path) {
$this->get('/'.$path)->assertOk()->assertInertia(fn (Assert $page) => $page->component('portal/services'));
$this->get('/'.$path)->assertOk()->assertInertia(fn (Assert $page) => $page->component($path === 'parcerias' ? 'partnerships/catalogue' : 'portal/services'));
}
$this->get('/balcao-virtual')->assertRedirect('/login');
$this->get('/management/portal-services')->assertRedirect('/login');
@@ -81,8 +81,9 @@ class PortalServicesTest extends TestCase
$this->post('/apoio', $payload)->assertSessionHasNoErrors();
$this->assertSame(1, InterestRequest::count());
$this->assertDatabaseCount('outbox_events', 1);
$this->get('/balcao-virtual')->assertInertia(fn (Assert $page) => $page->has('requests', 1));
$this->actingAs(User::factory()->create())->get('/balcao-virtual')->assertInertia(fn (Assert $page) => $page->has('requests', 0));
$this->get('/balcao-virtual')->assertRedirect('/balcao-virtual/painel');
$this->get('/balcao-virtual/painel')->assertInertia(fn (Assert $page) => $page->has('legacyRequests', 1));
$this->actingAs(User::factory()->create())->get('/balcao-virtual/painel')->assertInertia(fn (Assert $page) => $page->has('legacyRequests', 0));
$this->post('/apoio', $payload)->assertStatus(409);
}
@@ -102,13 +103,18 @@ class PortalServicesTest extends TestCase
$this->actingAs($owner)->post('/parcerias', ['title' => 'Parceria de teste', 'sector' => 'Agricultura', 'province' => 'Gaza',
'offer' => 'Capacidade de processamento de teste.', 'seeking' => 'Parceiro de logística para teste.', 'publication_consent' => true])->assertSessionHasNoErrors();
$id = DB::table('portal_partnerships')->value('id');
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('partnerships.data', 0));
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('results.data', 0));
$this->post('/management/portal-services/partnerships/'.$id, ['published' => true])->assertForbidden();
config(['portal.managers' => [$owner->email]]);
$this->post('/management/portal-services/partnerships/'.$id, ['published' => true])->assertSessionHasNoErrors();
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('partnerships.data', 1)->missing('partnerships.data.0.user_id'));
$this->post('/management/portal-services/partnerships/'.$id, ['published' => false])->assertSessionHasNoErrors();
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('partnerships.data', 0));
$moderator = User::factory()->create();
config(['portal.managers' => [$moderator->email]]);
$this->actingAs($moderator)->post('/management/portal-services/partnerships/'.$id, ['published' => true])->assertRedirect('/parcerias/'.$id);
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('results.data', 0));
$version = DB::table('portal_partnerships')->where('id', $id)->value('version');
$this->post('/parcerias/'.$id.'/estado', ['version' => $version, 'action' => 'publish', 'reason' => 'Divulgação autorizada e revista pelo moderador QA.'])->assertSessionHasNoErrors();
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('results.data', 1)->missing('results.data.0.user_id'));
$version = DB::table('portal_partnerships')->where('id', $id)->value('version');
$this->post('/parcerias/'.$id.'/estado', ['version' => $version, 'action' => 'suspend', 'reason' => 'Retirada de divulgação na revisão QA.'])->assertSessionHasNoErrors();
$this->get('/parcerias')->assertInertia(fn (Assert $page) => $page->has('results.data', 0));
}
public function test_document_download_rechecks_classification_checksum_and_publication(): void