hardman-commerce/magento2-fixtures
Composer 安装命令:
composer require hardman-commerce/magento2-fixtures
包简介
Fixture library for Magento 2 integration tests
README 文档
README
Forked from Magento 2 Fixtures by Fabian Schmengler.
Updated with code from Klevu Test Fixtures.
What is it?
An alternative to the procedural script-based fixtures in Magento 2 integration tests.
It aims to be:
- extensible
- expressive
- easy to use
Installation
Install it into your Magento 2 project with composer:
composer require --dev hardman-commerce/magento2-fixtures
Requirements
- Magento 2.4.4+
- PHP 8.1+
Documentation:
Catalog/Attribute
Fixtures and Traits to build catalog attributes, including store scope settings.
Useful when an attribute is required to create configurable products.
Catalog/Category
Fixtures and Traits to build categories, including store scope settings.
Catalog/Product
Fixtures and Traits to build products, including store scope settings.
Extended TDDWizard product fixtures to add
- Tier Prices
- Images
The following product types are covered
- Simple
- Virtual
- Downloadable
- Grouped
- Configurable
Todo:
- Bundle
- Gift Card
Catalog/Rule
Fixtures and Traits to build catalog price rules.
Checkout
Fixtures and Traits to build Cart and perform a customer checkout.
Add the following product types to the cart:
- Simple
- Configurable
- Grouped
Todo:
- Bundle
- Gift Card
CMS
Fixtures and Traits to build:
- Pages
Todo:
- Blocks
- Widgets
Core
Fixtures to create config settings.
Customer
Fixtures and Traits to build:
- Customer Addresses
- Customers
- Customer Groups
Sales
Fixtures to build:
- Credit memos
- Invoices
- Orders
- Shipments
Todo:
- Create traits
Store
Fixtures and Traits to build:
- Stores
- Store Groups
- Websites
Tax
Fixtures and Traits to build
- Tax Classes
- Tax Rates
- Tax Rules
Fixture pools
To manage multiple fixtures, fixture pools have been introduced for all entities:
Usage demonstrated with the ProductFixturePool:
protected function setUp()
{
$this->productFixtures = new ProductFixturePool;
}
protected function tearDown()
{
$this->productFixtures->rollback();
}
public function testSomethingWithMultipleProducts()
{
$this->productFixtures->add(ProductBuilder::aSimpleProduct()->build());
$this->productFixtures->add(ProductBuilder::aSimpleProduct()->build(), 'foo');
$this->productFixtures->add(ProductBuilder::aSimpleProduct()->build());
$this->productFixtures->get(); // returns ProductFixture object for last added product
$this->productFixtures->get('foo'); // returns ProductFixture object for product added with specific key 'foo'
$this->productFixtures->get(0); // returns ProductFixture object for first product added without specific key (numeric array index)
}
Credits
License
The MIT License (MIT). Please see License File for more information.
hardman-commerce/magento2-fixtures 适用场景与选型建议
hardman-commerce/magento2-fixtures 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hardman-commerce/magento2-fixtures 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hardman-commerce/magento2-fixtures 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-10