承接 visuallazza/fixture-generator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 class
  • isComplete: By default true all properties will be set, if flase only 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-04-15