与Storybdd扩展Sylius:增强产品库存管理 >
密钥概念:
我们创建一个behat功能文件():>
运行此操作会揭示缺失的步骤。 我们创建一个自定义上下文( 我们将此上下文配置在 , >最后,我们扩展了产品变体形式以允许修改重新排序级别。这涉及创建一个表单扩展名( 结论:
使用behat实施Storybdd测试
features/product/managing_products/browsing_products_with_inventory.feature
):@managing_inventory
Feature: Browsing products with inventory
In order to manage my shop merchandise
As an Administrator
I want to be able to browse products
Background:
Given the store operates on a single channel in "United States"
And the store has a product "Kubus"
And it comes in the following variations:
| name | price |
| Kubus Banana | .00 |
| Kubus Carrot | .00 |
And there are 3 units of "Kubus Banana" variant of product "Kubus" available in the inventory
And there are 5 units of "Kubus Carrot" variant of product "Kubus" available in the inventory
And I am logged in as an administrator
@ui
Scenario: Browsing defined products with inventory
Given the "Kubus Banana" product variant is tracked by the inventory
And the "Kubus Carrot" product variant is tracked by the inventory
When I want to browse products
Then I should see that the product "Kubus" has 8 on hand quantity
src/Sylius/Behat/Context/Ui/Admin/ManagingProductsInventoryContext.php
和<?php
// ... (imports) ...
class ManagingProductsInventoryContext implements Context
{
// ... (IndexPageInterface injection and methods) ...
}
,src/Sylius/Behat/Resources/config/services/contexts/ui.xml
)是必要的。src/Sylius/Behat/Resources/config/suites/ui/inventory/managing_inventory.yml
>
doctrine:database:create
实施丢失的步骤涉及使用Sylius的doctrine:schema:create
与产品列表进行交互,并断言以验证库存列的存在和数据。 我们还需要更新sylius网格配置(doctrine:schema:update
)以添加“库存”列并创建一个自定义模板(src/AppBundle/Form/Type/Extension/ProductVariantTypeExtension.php
),将其配置为服务(src/AppBundle/Resources/config/services.yml
),并更新相关模板(app/Resources/SyliusAdminBundle/views/ProductVariant/Tab/_details.html.twig
)。
以上是升级Sylius的TDD方式:探索Behat的详细内容。更多信息请关注PHP中文网其他相关文章!

本文比较了PHP和ASP.NET,重点是它们对大规模Web应用程序,性能差异和安全功能的适用性。两者对于大型项目都是可行的,但是PHP是开源和无关的,而ASP.NET,

本文讨论了PHP数据对象(PDO),这是PHP中数据库访问的扩展名。它通过准备好的语句及其对MySQLI的好处,包括数据库抽象和更好的错误处理,强调了PDO在增强安全性方面的作用。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

禅工作室 13.0.1
功能强大的PHP集成开发环境

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

SublimeText3 英文版
推荐:为Win版本,支持代码提示!