adrema/tests/Feature/Subscription/EditTest.php

37 lines
1.0 KiB
PHP
Raw Normal View History

2022-12-13 23:11:32 +01:00
<?php
namespace Tests\Feature\Subscription;
use App\Fee;
use App\Payment\Subscription;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\RequestFactories\Child;
use Tests\TestCase;
class EditTest extends TestCase
{
use DatabaseTransactions;
public function testItReturnsChildren(): void
{
$this->withoutExceptionHandling()->login()->loginNami();
2022-12-14 23:20:05 +01:00
$subscription = Subscription::factory()->name('hi')->forPromise()->for(Fee::factory())->children([
2022-12-13 23:11:32 +01:00
new Child('a', 1400),
new Child('b', 1500),
2022-12-14 00:23:03 +01:00
])->create(['split' => true]);
2022-12-13 23:11:32 +01:00
$response = $this->get("/subscription/{$subscription->id}/edit");
$this->assertInertiaHas([
'children' => [
['name' => 'a', 'amount' => 1400],
['name' => 'b', 'amount' => 1500],
],
'name' => 'hi',
'id' => $subscription->id,
2022-12-14 00:23:03 +01:00
'split' => true,
2022-12-14 23:20:05 +01:00
'for_promise' => true,
2022-12-13 23:11:32 +01:00
], $response, 'data');
}
}