adrema/tests/Lib/MakesHttpCalls.php

29 lines
596 B
PHP
Raw Normal View History

2023-02-23 22:43:13 +01:00
<?php
namespace Tests\Lib;
use Illuminate\Testing\TestResponse;
trait MakesHttpCalls
{
/**
* @param array<string, mixed> $filter
*/
public function callFilter(string $routeName, array $filter): TestResponse
{
return $this->call('GET', $this->filterUrl($routeName, $filter));
}
/**
* @param array<string, mixed> $filter
*/
public function filterUrl(string $routeName, array $filter): string
{
$params = [
'filter' => base64_encode(json_encode($filter)),
];
return route($routeName, $params);
}
}