adrema/tests/Feature/Invoice/InvoiceRequestFactory.php

42 lines
942 B
PHP
Raw Normal View History

2023-12-13 00:35:39 +01:00
<?php
namespace Tests\Feature\Invoice;
2023-12-16 11:18:00 +01:00
use App\Invoice\BillKind;
2023-12-13 00:35:39 +01:00
use App\Invoice\Enums\InvoiceStatus;
use Worksome\RequestFactories\RequestFactory;
class InvoiceRequestFactory extends RequestFactory
{
public function definition(): array
{
return [
'to' => ReceiverRequestFactory::new(),
'greeting' => 'Hallo Familie',
'positions' => []
];
}
public function to(ReceiverRequestFactory $to): self
{
return $this->state(['to' => $to]);
}
public function status(InvoiceStatus $status): self
{
return $this->state(['status' => $status->value]);
}
public function position(InvoicePositionRequestFactory $factory): self
{
return $this->state(['positions' => [
$factory->create(),
]]);
}
2023-12-16 11:18:00 +01:00
public function via(BillKind $via): self
{
return $this->state(['via' => $via->value]);
}
2023-12-13 00:35:39 +01:00
}