diff --git a/docs/index.md b/docs/index.md index 4f6ca51..5270e32 100644 --- a/docs/index.md +++ b/docs/index.md @@ -135,6 +135,9 @@ services: In forms with more than a field of the same type, use `self::getImageFile('1')`, `self::getImageFile('2')`, etc. You can also use `self::getFile('0', $data, 'png', 'image/png')` and pass directly your file data. + 💡 ** Bonus** The above methods are shortcuts for the `Beelab\TestBundle\File\FileInjector` class, so you + can use them in your fixtures, too. Import the class and use `FileInjector::getFile()` etc. + * Form values shortcut If you need to retrieve the value of a form field, you can use `self::getFormValue('form_field')`. diff --git a/src/File/FileInjector.php b/src/File/FileInjector.php new file mode 100644 index 0000000..3ae9489 --- /dev/null +++ b/src/File/FileInjector.php @@ -0,0 +1,58 @@ +