/ tests / Unit / Jobs / ProcessCertificationRequestMailboxTest.php
ProcessCertificationRequestMailboxTest.php
 1  <?php
 2  
 3  namespace Tests\Unit\Jobs;
 4  
 5  use App\Jobs\ProcessCertificationRequestMailbox;
 6  use App\Models\NormGroup;
 7  use App\Models\ValidationType;
 8  use Illuminate\Support\Facades\Mail;
 9  use Illuminate\Support\Facades\Storage;
10  use Tests\TestCase;
11  
12  class ProcessCertificationRequestMailboxTest extends TestCase
13  {
14      public string $to = 'test@mail.es';
15      public string $pdf = 'test_files/certification_request/01. FOR-001/certification_request_v1.0.0.pdf';
16      public string $tmp = 'tmp/certification_request_v1.0.0.pdf';
17  
18      public function setUp(): void
19      {
20          parent::setUp();
21          Mail::fake();
22  
23          $norm = NormGroup::where('name', 'CC')->first()->norms->where('version', 'v3.1R5')->first();
24  
25          Storage::copy($this->pdf, $this->tmp);
26      }
27  
28      /** @test */
29      public function process_email() {
30          $job = new ProcessCertificationRequestMailbox();
31          $inboxFile = $job->processMessage([
32              'from' => $this->to,
33              'path' => $this->tmp,
34          ]);
35  
36          $this->assertNotNull($inboxFile);
37      }
38  }