From 6e94084381c6995da0d509e3f10eabb15b2913d5 Mon Sep 17 00:00:00 2001 From: curder Date: Wed, 12 Jun 2024 18:38:04 +0800 Subject: [PATCH] Add custom file macro method test case --- docs/others/macros.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/others/macros.md b/docs/others/macros.md index 5f0d7c49e..c0353ca51 100644 --- a/docs/others/macros.md +++ b/docs/others/macros.md @@ -400,6 +400,22 @@ public function store($request) // ... } ``` + + +```php [测试] +/** + * @throws ReflectionException + */ +it('has custom types when using document macro', function () { + + $file = (new \Illuminate\Validation\Rules\File())->document(); + + $types = ['pdf', 'rtf', 'doc', 'docx']; + $allowedMimetypes = (new ReflectionClass($file))->getProperty('allowedMimetypes')->getValue($file); + + expect($allowedMimetypes)->toEqual($types); +}); +``` ::: ### `Carbon`