sandyandi/test-uploadedfile-factory
最新稳定版本:1.0.4
Composer 安装命令:
composer require sandyandi/test-uploadedfile-factory
包简介
UploadedFile Factory for Testing
README 文档
README
A simple Symfony\Component\HttpFoundation\File\UploadedFile factory for testing
Installation
Run the following:
composer require sandyandi/test-uploadedfile-factory:1.0.*
Usage
Instantiation
use Sandyandi\TestUploadedFileFactory\TestUploadedFileFactory; $testUploadedFileFactory = new TestUploadedFileFactory;
By default, it will use the /tmp directory located in vendor/sandyandi/test-uploadedfile-factory as its working directory. You can specify a different directory by specifying the directory path during instantiation:
$workDir = 'path/to/your/work/dir'; $testUploadedFileFactory = new TestUploadedFileFactory($workDir);
Note: make sure the working directory is writeable.
Object creation
Once the factory has been instantiated, you can create an UploadedFile instance by doing the following:
$pathToFile = 'path/to/your/file'; $uploadedFile = $testUploadedFileFactory->create($pathTofile);
The factory will create a copy of your file and put it in the working directory.
tearDown()
Be sure to call $testUploadedFileFactory->tearDown(); in your test's tearDown() method to delete all created/moved files.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-07