respect-validation/tests/feature/Message/StandardStringifierTest.php
Henrique Moody b8f494955c
Implement a custom stringifier
The standards `CompositeStringifier` from "respect/stringifier" has lots
of interesting stringifiers. However, this library is not 100% focused
on engineers. Someone could type a string that matches a callable, and
then you will overexpose the system.

This commit makes sure that callables are not interpreted as callables.
2024-12-27 00:15:59 +01:00

19 lines
440 B
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
use Respect\Validation\Message\StandardStringifier;
test('Should return `unknown` when cannot stringify value', function (): void {
$resource = tmpfile();
fclose($resource);
$stringifier = new StandardStringifier();
expect($stringifier->stringify($resource, 0))->toBe('`unknown`');
});