tijmen-wierenga/bogus-fixtures-bundle
Composer 安装命令:
composer require tijmen-wierenga/bogus-fixtures-bundle
包简介
A Symfony bundle for creating dummy data fixtures through Bogus
README 文档
README
The BogusFixturesBundle adds the functionality of tijmen-wierenga/bogus to a Symfony 4 application.
For any questions regarding this bundle, feel free to contact Tijmen Wierenga at t.wierenga@live.nl.
Installation
You can install this bundle into your Symfony applications with composer:
composer require tijmen-wierenga/bogus-fixtures-bundle
If you only want to use the bundle in development (a lot of times you'll only use it for testing purposes):
composer require --dev tijmen-wierenga/bogus-fixtures-bundle
If you're using Symfony 3.4 or lower, you'll need to register the bundle as well:
// app/AppKernel.php // ... class AppKernel extends Kernel { // ... public function registerBundles() { // For global registration $bundles = array( // ... new TijmenWierenga\Bundle\BogusFixturesBundle(), ); // For development/testing registration only if (in_array($this->getEnvironment(), array('dev', 'test'))) { $bundles[] = new TijmenWierenga\Bundle\BogusFixturesBundle(); } } }
Usage
Usage instructions for the Bogus library can be find in the project's README.md.
If your Symfony project allows for auto-configuration (3.4 or higher), you can add the following lines to your services.yaml file:
_instanceof: TijmenWierenga\Bogus\Factory\Factory: tags: ['bogus_fixtures.factory']
This will automatically tag any instance of TijmenWierenga\Bogus\Factory\Factory with the bogus_fixtures.factory tag.
The factory will be automatically added to the Fixtures base class.
If you prefer you add the labels yourself, or your Symfony application doesn't allow for auto-registration, you can tag individual services:
App\Factories\UserFactory: tags: ['bogus_fixtures.factory']
For usage in tests the bundle comes with a trait. Use it in your test cases like this:
namespace App\Tests; use App\Entity\User; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use TijmenWierenga\Bundle\BogusFixturesBundle\Fixtures; class FixturesTest extends KernelTestCase { use Fixtures; public function setUp() { self::bootKernel(); } public function testItBuildsAFixture() { $user = $this->fixtures()->create(User::class); // Will generate a User } }
tijmen-wierenga/bogus-fixtures-bundle 适用场景与选型建议
tijmen-wierenga/bogus-fixtures-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 107 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tijmen-wierenga/bogus-fixtures-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tijmen-wierenga/bogus-fixtures-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 107
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-16