This commit is contained in:
philipp lang 2022-03-06 02:56:22 +01:00
parent 51fbc4b1aa
commit 7ba76b0908
2 changed files with 5 additions and 2 deletions
database/factories/Member
tests

View File

@ -10,6 +10,7 @@ use App\Nationality;
use App\Payment\Payment;
use App\Payment\Subscription;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Model;
/**
* @extends Factory<Member>
@ -70,7 +71,7 @@ class MemberFactory extends Factory
*/
public function withPayments(array $payments): self
{
return $this->afterCreating(function (Member $model) use ($payments): void {
return $this->afterCreating(function (Model $model) use ($payments): mixed {
foreach ($payments as $paymentClosure) {
$factory = Payment::factory()->for($model);
$factory = call_user_func($paymentClosure, $factory);

View File

@ -63,7 +63,9 @@ abstract class TestCase extends BaseTestCase
return $this;
}
public function assertErrors(array $errors, TestResponse $response) {
public function assertErrors(array $errors, TestResponse $response): self
{
$response->assertSessionHas('errors');
$this->assertInstanceOf(RedirectResponse::class, $response->baseResponse);
/** @var RedirectResponse */