diff --git a/app/Invoice/Resources/InvoiceResource.php b/app/Invoice/Resources/InvoiceResource.php index 2be9ca39..95c3eff7 100644 --- a/app/Invoice/Resources/InvoiceResource.php +++ b/app/Invoice/Resources/InvoiceResource.php @@ -7,6 +7,7 @@ use App\Invoice\Enums\InvoiceStatus; use App\Invoice\Models\Invoice; use App\Lib\HasMeta; use App\Member\Member; +use App\Payment\Subscription; use Illuminate\Http\Resources\Json\JsonResource; /** @@ -59,6 +60,7 @@ class InvoiceResource extends JsonResource 'vias' => BillKind::forSelect(), 'statuses' => InvoiceStatus::forSelect(), 'members' => Member::forSelect(), + 'subscriptions' => Subscription::forSelect(), 'default' => [ 'to' => [ 'name' => '', diff --git a/tests/Feature/Invoice/InvoiceIndexActionTest.php b/tests/Feature/Invoice/InvoiceIndexActionTest.php index 9248b124..11a9abc9 100644 --- a/tests/Feature/Invoice/InvoiceIndexActionTest.php +++ b/tests/Feature/Invoice/InvoiceIndexActionTest.php @@ -7,6 +7,7 @@ use App\Invoice\Enums\InvoiceStatus; use App\Invoice\Models\Invoice; use App\Invoice\Models\InvoicePosition; use App\Member\Member; +use App\Payment\Subscription; use Illuminate\Foundation\Testing\DatabaseTransactions; use Tests\TestCase; @@ -18,6 +19,7 @@ class InvoiceIndexActionTest extends TestCase public function testItDisplaysInvoices(): void { $this->login()->loginNami()->withoutExceptionHandling(); + $subscription = Subscription::factory()->name('Beitrag')->create(); $member = Member::factory()->defaults()->create(['firstname' => 'Aaaa', 'lastname' => 'Aaab']); $invoice = Invoice::factory() ->has(InvoicePosition::factory()->price(1100)->for($member)->state(['description' => 'lala']), 'positions') @@ -52,6 +54,7 @@ class InvoiceIndexActionTest extends TestCase ->assertInertiaPath('data.meta.vias.0', ['id' => 'E-Mail', 'name' => 'E-Mail']) ->assertInertiaPath('data.meta.statuses.0', ['id' => 'Neu', 'name' => 'Neu']) ->assertInertiaPath('data.meta.members.0', ['id' => $member->id, 'name' => 'Aaaa Aaab']) + ->assertInertiaPath('data.meta.subscriptions.0', ['name' => 'Beitrag', 'id' => $subscription->id]) ->assertInertiaPath('data.meta.default', [ 'to' => [ 'name' => '',