Minor fixes for tests

This commit is contained in:
David Bomba 2023-10-28 22:27:31 +11:00
parent a73e5b5d8f
commit 0f57b067c5

View File

@ -12,9 +12,9 @@
namespace Tests\Pdf; namespace Tests\Pdf;
use App\DataMapper\CompanySettings;
use Tests\TestCase; use Tests\TestCase;
use App\Models\Design; use App\Models\Design;
use App\Models\Account;
use App\Models\Company; use App\Models\Company;
use App\Models\Country; use App\Models\Country;
use App\Models\Invoice; use App\Models\Invoice;
@ -24,6 +24,7 @@ use App\Services\Pdf\PdfMock;
use Beganovich\Snappdf\Snappdf; use Beganovich\Snappdf\Snappdf;
use App\Services\Pdf\PdfBuilder; use App\Services\Pdf\PdfBuilder;
use App\Services\Pdf\PdfService; use App\Services\Pdf\PdfService;
use App\DataMapper\CompanySettings;
use App\Services\Pdf\PdfConfiguration; use App\Services\Pdf\PdfConfiguration;
/** /**
@ -47,7 +48,11 @@ class PdfmockTest extends TestCase
'entity_type' => 'invoice', 'entity_type' => 'invoice',
]; ];
$entity = (new \App\Services\Pdf\PdfMock($data, Company::factory()->make()))->build()->initEntity(); $company = Company::factory()->make();
$account = Account::factory()->make();
$company->setRelation('account', $account);
$entity = (new \App\Services\Pdf\PdfMock($data,$company))->build()->initEntity();
$this->assertInstanceOf(Invoice::class, $entity); $this->assertInstanceOf(Invoice::class, $entity);
$this->assertNotNull($entity->client); $this->assertNotNull($entity->client);
@ -71,7 +76,11 @@ class PdfmockTest extends TestCase
'entity_type' => 'invoice', 'entity_type' => 'invoice',
]; ];
$pdf_mock = (new PdfMock($data, Company::factory()->make()))->build(); $company = Company::factory()->make();
$account = Account::factory()->make();
$company->setRelation('account', $account);
$pdf_mock = (new PdfMock($data, $company))->build();
$mock = $pdf_mock->initEntity(); $mock = $pdf_mock->initEntity();
$pdf_service = new PdfService($mock->invitation); $pdf_service = new PdfService($mock->invitation);