adrema/tests/Lib/MakesHttpCalls.php

29 lines
610 B
PHP
Raw Permalink 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 = [
2023-03-22 23:37:36 +01:00
'filter' => base64_encode(rawurlencode(json_encode($filter))),
2023-02-23 22:43:13 +01:00
];
return route($routeName, $params);
}
}