This commit is contained in:
philipp lang 2022-02-12 01:25:22 +01:00
parent 843a7137cc
commit 00323cc6ac
2 changed files with 8 additions and 5 deletions

View File

@ -4,13 +4,13 @@ namespace App\Pdf;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Member\Member; use App\Member\Member;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response;
class MemberPdfController extends Controller class MemberPdfController extends Controller
{ {
public function __invoke(Request $request, Member $member): Responsable public function __invoke(Request $request, Member $member)
{ {
$repo = app(PdfRepositoryFactory::class)->fromSingleRequest($request->type, $member); $repo = app(PdfRepositoryFactory::class)->fromSingleRequest($request->type, $member);

View File

@ -7,7 +7,7 @@ use PHPUnit\Framework\Assert as PHPUnit;
trait TestsInertia { trait TestsInertia {
public function assertInertiaHas(mixed $value, TestResponse $response, ?string $key = null): void public function assertInertiaHas($value, TestResponse $response, ?string $key = null): void
{ {
$bindings = json_decode(json_encode($value), true); $bindings = json_decode(json_encode($value), true);
$viewData = json_decode(json_encode( $viewData = json_decode(json_encode(
@ -23,7 +23,7 @@ trait TestsInertia {
PHPUnit::assertEquals($component, $response->viewData('page')['component']); PHPUnit::assertEquals($component, $response->viewData('page')['component']);
} }
public function assertInertiaDeepNest(mixed $should, mixed $is): void public function assertInertiaDeepNest($should, $is): void
{ {
foreach ($should as $key => $value) { foreach ($should as $key => $value) {
PHPUnit::assertArrayHasKey($key, $is); PHPUnit::assertArrayHasKey($key, $is);
@ -37,7 +37,10 @@ trait TestsInertia {
} }
} }
public function inertia(TestResponse $response, string $key): mixed /**
* @return mixed
*/
public function inertia(TestResponse $response, string $key)
{ {
return data_get($response->viewData('page')['props'], $key); return data_get($response->viewData('page')['props'], $key);
} }