定制 fittinq/symfony-behat-rabbitmq 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

fittinq/symfony-behat-rabbitmq

Composer 安装命令:

composer require fittinq/symfony-behat-rabbitmq

包简介

README 文档

README

The Symfony Behat RabbitMQ Bundle simplifies the process of writing Behat tests for RabbitMQ integration in your Symfony application. This bundle provides a set of Behat context steps that streamline the interaction with RabbitMQ queues and exchanges, allowing you to thoroughly test and validate message flows.

Table of Contents

Introduction

Testing RabbitMQ integration in your Symfony application can be a complex and challenging task. This bundle aims to simplify this process by offering a collection of Behat context steps that enable you to interact with RabbitMQ components seamlessly. With this bundle, you can effortlessly create scenarios to test RabbitMQ message flows, ensuring that your application functions as expected.

Installation

To integrate the "symfony-behat-rabbitmq" bundle into your Symfony project, follow these steps:

  1. Install the bundle using Composer:

     composer require fittinq/symfony-behat-rabbitmq
    
  2. Register the bundle in your Symfony application. If you are using Symfony Flex, the bundle should be automatically registered. If not, make sure to add it to your config/bundles.php file.

Usage

To utilize the "symfony-behat-rabbitMQ" bundle, follow these steps:

Create Exchanges

Define your exchanges in your Behat feature file to simulate the RabbitMQ message flow:

And there are exchanges
| source | event  | 
| bakery | bread  | 
| bakery | flour  |

Create Queues with Exchanges

Specify the queues associated with the defined exchanges:

And there are queues
| exchange     | queue              |
| bakery.bread | bakery.bread.baked |

Send Messages to Exchanges

Send messages to the specified exchanges to trigger the RabbitMQ flow:

When a message is sent to bakery.bread
"""
{
    "Type": "Wheat bread",
    "ingredients": [
        "Flour",
        "Water",
        "Eggs"
    ]
}
"""

Assert Message Acknowledgment in Queue

Ensure that the message in the queue has been acknowledged:

Then assert that the message in queue bakery.bread.baked is acked

Configuration

To complete the setup, configure your Behat suite to include the RabbitMQContext. Here's an example of how to configure your Behat suite in your behat.yml file:

default:
   suites:
      default:
         paths:
            - features
         contexts:
            - Fittinq\Symfony\Behat\RabbitMQ\Context\RabbitMQContext

统计信息

  • 总下载量: 4.64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-09-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固