login()->loginNami(); $member = Member::factory() ->defaults() ->has(Payment::factory()->notPaid()->nr('1997')->subscription('tollerbeitrag', [ new Child('a', 5400), ])) ->emailBillKind() ->create(['firstname' => 'Lah', 'lastname' => 'Mom', 'email' => 'peter@example.com']); /** @var Collection<(int|string), Member> */ $members = collect([$member]); app(DocumentFactory::class)->afterSingle(BillDocument::fromMembers($members), $members); $response = $this->get(route('payment.pdf', ['payment' => $member->payments->first()])); $response->assertOk(); $this->assertPdfPageCount(1, $response->getFile()); } public function testItReturnsNoPdfWhenPaymentDoesntHaveInvoiceData(): void { $this->login()->loginNami(); $member = Member::factory() ->defaults() ->has(Payment::factory()->notPaid()->nr('1997')->subscription('tollerbeitrag', [ new Child('a', 5400), ])) ->emailBillKind() ->create(['firstname' => 'Lah', 'lastname' => 'Mom', 'email' => 'peter@example.com']); $response = $this->get(route('payment.pdf', ['payment' => $member->payments->first()])); $response->assertStatus(204); } }