class UploadValidatorExtensionTest extends TypeTestCase
{ public function testPostMaxSizeTranslation() { $extension =
new UploadValidatorExtension(new DummyTranslator());
$resolver =
new OptionsResolver();
$resolver->
setDefault('post_max_size_message', 'old max {{ max }}!'
);
$resolver->
setDefault('upload_max_size_message',
fn (Options
$options) =>
fn () =>
$options['post_max_size_message'
]);
$extension->
configureOptions($resolver);
$options =
$resolver->
resolve();
$this->
assertEquals('translated max {{ max }}!',
$options['upload_max_size_message'
]());
}}class DummyTranslator implements TranslatorInterface, LocaleAwareInterface
{ public function trans($id, array
$parameters =
[],
$domain = null,
$locale = null
): string
{ return 'translated max {{ max }}!';
}