laravel-nami-api/tests/Factories/MemberRequestFactory.php

40 lines
947 B
PHP
Raw Normal View History

2022-11-29 17:14:31 +01:00
<?php
namespace Zoomyboy\LaravelNami\Tests\Factories;
use GuzzleHttp\Promise\FulfilledPromise;
use Illuminate\Support\Facades\Http;
use Worksome\RequestFactories\RequestFactory;
class MemberRequestFactory extends RequestFactory
{
public function definition(): array
{
return [
'vorname' => $this->faker->firstName,
'nachname' => $this->faker->lastName,
'nickname' => $this->faker->firstName,
];
}
2022-11-29 17:19:00 +01:00
public function withEmptyNames(): self
{
return $this->state([
'vorname' => '',
'nachname' => '',
'nickname' => '',
]);
}
2022-11-29 17:14:31 +01:00
public function toSingleHttp(): FulfilledPromise
{
2022-11-29 17:19:00 +01:00
return Http::response(json_encode([
'success' => true,
'message' => null,
'title' => null,
'data' => $this->create(),
'responseType' => null,
]), 200);
2022-11-29 17:14:31 +01:00
}
}