Laravel\Lumen\Testing\Concerns\MakesHttpRequests::formatToExpectedJson PHP Method

formatToExpectedJson() protected method

Format the given key and value into a JSON string for expectation checks.
protected formatToExpectedJson ( string $key, mixed $value ) : string
$key string
$value mixed
return string
    protected function formatToExpectedJson($key, $value)
    {
        $expected = json_encode([$key => $value]);
        if (Str::startsWith($expected, '{')) {
            $expected = substr($expected, 1);
        }
        if (Str::endsWith($expected, '}')) {
            $expected = substr($expected, 0, -1);
        }
        return $expected;
    }