withoutExceptionHandling()->login()->loginNami(); $member = Member::factory() ->has(Payment::factory()->notPaid()->nr('2019')->subscription('Free', [ new Child('a', 1000), new Child('b', 50), ])) ->defaults()->create(); $payment = $member->payments->first(); $this->get("/member/{$member->id}/payment") ->assertJsonPath('data.0.subscription.name', 'Free') ->assertJsonPath('data.0.subscription.id', $payment->subscription->id) ->assertJsonPath('data.0.subscription.amount', 1050) ->assertJsonPath('data.0.subscription_id', $payment->subscription->id) ->assertJsonPath('data.0.status_name', 'Nicht bezahlt') ->assertJsonPath('data.0.nr', '2019') ->assertJsonPath('data.0.links.update', url("/payment/{$payment->id}")) ->assertJsonPath('data.0.links.destroy', url("/payment/{$payment->id}")) ->assertJsonPath('meta.statuses.0.name', 'Nicht bezahlt') ->assertJsonPath('meta.statuses.0.id', $payment->status->id) ->assertJsonPath('meta.subscriptions.0.id', Subscription::first()->id) ->assertJsonPath('meta.subscriptions.0.name', Subscription::first()->name) ->assertJsonPath('meta.links.store', url("/member/{$member->id}/payment")); } }