hardman-commerce/magento2-fixtures
最新稳定版本:2.0.0
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.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-10