visuallazza/fixture-generator
最新稳定版本:v0.0.1
Composer 安装命令:
composer require visuallazza/fixture-generator
包简介
events/interfaces
README 文档
README
This package helps you to generate fixtures out of your DTO's. To be able to use the fixture-generator your DTO's has to extend the DataTransferObject of Spatie
use Spatie\DataTransferObject\DataTransferObject;
class YourDto extends DataTransferObject
{}
Add the generator to your deps
Link to packagist
composer require visuallazza/fixture-generator
How to use
The method will generate an object with either with placeholder values.
className: Full qualified Name of the classisComplete: By defaulttrueall properties will be set, ifflaseonly required properties will be set.dataSet: Set each property as test case requires. The other properties will be set
use Fixture\Generator\Models\Primitive;
use PHPUnit\Framework\TestCase;
class TestCase extends TestCase
{
use HasFixtureGenerator;
public function test(): void
{
$dataSet = [
'int' => 5,
];
$generatedObject = $this->generate(
className: Primitive::class,
isComplete: false,
providedData: $dataSet
);
}
}
Dependencies
To generate the objects the spatie DTO is in use.
"spatie/data-transfer-object": "^3.9",
Test
Run all test with the make command
make test
Lint
make lint
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-04-15