Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: convenia/Pigeon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.1.0
Choose a base ref
...
head repository: convenia/Pigeon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 12 commits
  • 27 files changed
  • 4 contributors

Commits on May 26, 2022

  1. fixing requires (#284)

    Some packages were getting conflicts because of the way we are requiring the Laravel version
    jleonardolemos authored May 26, 2022
    Copy the full SHA
    1ddd390 View commit details

Commits on Aug 7, 2022

  1. Creation of a Developer Environment (#280)

    * feat(docker compose): adding a environment for development.
    
    * chore(docker compose): changing the project's path.
    
    * fix(dockerfile): adding extension for skipped test.
    
    * fix(github actions): updating php version and setting rabbitmq version to 3.8.
    TarsisioXavier authored Aug 7, 2022
    Copy the full SHA
    cf190b6 View commit details

Commits on Mar 3, 2023

  1. Release 2.2 (#307)

    * add PHP 8.2 to Actions
    
    * increase ubuntu version on pipelines
    
    * Counting Dispatched Messages (#295)
    
    * feat(assertions): adding assertions to count messages.
    
    * docs(changelog): breaking lines.
    
    * docs(testing): adding new functions in testing section.
    
    * docs(testing): fixing dispatch method.
    
    * Laravel 10 support
    
    ---------
    
    Co-authored-by: Tarsísio Xavier and Leonardo Lemos
    jleonardolemos authored Mar 3, 2023
    Copy the full SHA
    aa1307e View commit details

Commits on Apr 27, 2023

  1. Copy the full SHA
    54f9091 View commit details
  2. Copy the full SHA
    ddbb737 View commit details
  3. update change log

    jleonardolemos committed Apr 27, 2023
    Copy the full SHA
    42a54d7 View commit details
  4. Copy the full SHA
    e89312a View commit details

Commits on Dec 5, 2023

  1. Php8.3 (#314)

    * add PHP8.3 Support
    
    * fix risk tests
    jleonardolemos authored Dec 5, 2023
    Copy the full SHA
    6596f3d View commit details

Commits on Dec 13, 2023

  1. Copy the full SHA
    8185661 View commit details

Commits on Mar 29, 2024

  1. Laravel 11 (#323)

    * upgrade laravel and PHPunit
    
    * upgrade github action checkout
    
    * upgrade github action cache
    
    * apply old phpunit xml
    
    * try color always
    jleonardolemos authored Mar 29, 2024
    Copy the full SHA
    a366b9e View commit details
  2. upgrade changelog

    jleonardolemos committed Mar 29, 2024
    Copy the full SHA
    96850bb View commit details

Commits on Jan 13, 2025

  1. Upgrade/php8.4 (#324)

    * upgrade PHP version to 8.4
    
    * try ubuntu 24 on CI/CD
    
    * add explicit nullables
    jleonardolemos authored Jan 13, 2025
    Copy the full SHA
    ed10a8d View commit details
20 changes: 10 additions & 10 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
@@ -11,13 +11,13 @@ jobs:
ports:
- 5672:5672

runs-on: ubuntu-18.04
runs-on: ubuntu-24.04
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -29,7 +29,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
@@ -40,13 +40,13 @@ jobs:
run: composer update --prefer-dist --no-interaction

- name: Run phpunit
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --configuration=phpunit-ci.xml
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --configuration=phpunit-ci-old-versions.xml

- name: Install lowest dependencies
run: composer update --prefer-dist --no-interaction --prefer-lowest

- name: Run phpunit with lowest dependencies
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --configuration=phpunit-ci.xml
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --configuration=phpunit-ci-old-versions.xml

build-new-php-version:

@@ -56,13 +56,13 @@ jobs:
ports:
- 5672:5672

runs-on: ubuntu-18.04
runs-on: ubuntu-24.04
strategy:
matrix:
php-versions: ['8.1']
php-versions: ['8.1', '8.2', '8.3', '8.4']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -74,7 +74,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
@@ -85,4 +85,4 @@ jobs:
run: composer update --prefer-dist --no-interaction

- name: Run phpunit
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --configuration=phpunit-ci.xml
run: XDEBUG_MODE=coverage vendor/bin/phpunit --color="always" --coverage-text --configuration=phpunit-ci.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.idea
.phpunit.result.cache
.phpunit.cache
test.results
vendor/
coverage/
.coverage/
composer.lock
phpunit.xml
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,22 +5,51 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v2.5.0]
### Added
- Support PHP 8.4

## [v2.4.0]
### Added
- Support for Laravel 11

## [v2.3.0]
### Added
- Support PHP 8.3

## [v2.2.1]
### Removed
- Remove webpatser/uuid dependency.
### Changed
- Change correlation_id uuid to be generated with Str::uuid helper

## [v2.2.0]
### Added
- Support Laravel 10.
- Support PHP 8.2.
- Function Pigeon::assertNothingDispatched().
- Function Pigeon::assertDispatchedCount(int $count).

## [v2.1.0]
### Added
- Laravel 9 support
- php 8.1 support

## [v2.0.0]
### Fixed
- Properties on publish method
- Reconnect when missed heart beat

### Added
- Laravel 8 support
- Added `Pigeon::assertNotDispatched()` method to Fake driver

### Changed
- Change `emmit` method name to `dispatch`
- Change `assertEmitted` method name to `assertDispatched`
- Property `Convenia\Pigeon\Resolver\Resolver::message` is public now
- Method `Convenia\Pigeon\Publisher\PublisherContract::publish()` now have the second param as a properties array

### Removed
- Methods `Pigeon::rpc`, `Convenia\Pigeon\Resolver::response`, `Pigeon::assertRpc`, `Pigeon::rpcPushed`, `Pigeon::assertCallbackReturn`
- Drop PHP 7.2 support
@@ -35,8 +64,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added hability to test for timeout on consumers
- Added hability to test for comsmer multiplicit

### Changed
- Catch `Throwble` instead of `Exception` on default fallback

### Fixed
- Fixed support for Laravel 6
- Fixed facade `dispatch` signature
@@ -48,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [v1.4.0]
### Added
- Added hability to send to default exchange when the exchange name is empty in `exchange()` method

### Fixed
- Fixed use of empty string on exchange to use default AMQP queue

@@ -60,6 +92,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `on-failure` config to ack, reject or throw exception
- Added `Pigeon::headers([])` and config `headers` key
- Added possibility to use callable on headers config

### Fixed
- Fixed failing when not set fallback and throw exception
- Fixed wrong `MessageProcessorTest` tests
@@ -68,9 +101,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added bugs test suite
- Added null driver throw `Convenia\Pigeon\Exceptions\Driver\NullDriverException` exception

### Fixed
- Fix `No free channel id` message when emit large amount of events
- Fix env example

### Changed
- Change default driver to `rabbit`

@@ -82,6 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add `application_headers` to `Pigeon::dispatch` as last parameter
- Add configurable precondition catch on queue creation

### Fixed
- Auto declare exchange with `routing`
- Fix `application_headers` to `AMQPTable`
@@ -100,16 +136,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added dead letter exchange to queue/exchange declare
- Added laravel auto discovery
- Added config as publishable using `pigeon.config`

### Change
- Default timeout from 5 to 0

### Fixed
- Fix acknowledge with fake

### Removed
- Remove `$properties` from `PublisherContract::publish()`, `PublisherContract::rpc()`

## [v1.0.0-alpha-1]
### Fixed
- Fixed `getDefaultDriver` return from config

### Change
- Change event listen wildcard from `*` to `#`
- Change event exchange type from `direct` to `topic`
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM php:8.4-fpm-alpine

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN apk --no-cache --update add libmemcached-dev zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev libxml2-dev

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd fileinfo dom xml simplexml pcntl

RUN install-php-extensions sockets xdebug

RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
{
"name": "Kauan Sousa",
"email": "kauanslr.ks@gmail.com",
"role": "Maintainer"
"role": "Author"
},
{
"name": "Leonardo Lemos",
@@ -17,18 +17,17 @@
}
],
"require": {
"php": ">=7.3|>=8.1",
"php": ">=7.3",
"ext-json": "*",
"ext-sockets": "*",
"php-amqplib/php-amqplib": "^3.1",
"laravel/framework": "^6.20.12|^7.30.4|^8.22.1|^9.2",
"webpatser/laravel-uuid": "^4.0"
"laravel/framework": "^6.20.12|^7.30.4|>=8.22.1|>=9.2|^10.0|^11.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^9.5|^10.0",
"squizlabs/php_codesniffer": "^2.5",
"orchestra/testbench": "^4.18|^6.21",
"orchestra/testbench": "^4.18|^6.21|^8.0|^9.0",
"mockery/mockery": "^1.3"
},
"autoload": {
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.3'
services:
pigeon:
container_name: pigeon
build: .
working_dir: /var/www/package
volumes:
- .:/var/www/package
networks:
pigeon-network:
ipv4_address: 172.40.10.30
aliases:
- rabbitmq

rabbitmq:
container_name: rabbitmq
image: rabbitmq:3.8
hostname: rabbitmq
networks:
pigeon-network:
ipv4_address: 172.40.10.20
aliases:
- rabbitmq

networks:
pigeon-network:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.40.10.0/24
38 changes: 37 additions & 1 deletion docs/TESTING.md
Original file line number Diff line number Diff line change
@@ -58,4 +58,40 @@ Pigeon::dispatchConsumer(
'the.queue.name',
['mocked' => 'message'] // mocked incoming message
);
```
```

There is a way to only verify the expected quatity of messages sent.

If you want to assert the exact number of messages, use `assertDispatchCount`.
```php
<?php

use Convenia\Pigeon\Facade\Pigeon;

Pigeon::fake();

Pigeon::dispatch('my-queue', [
'some-data' => 123,
]);

Pigeon::dispatch('another-great-queue', [
'some-data' => 123,
]);

Pigeon::assertDispatchCount(2); // Returns true
```

If you want to only check if nothing was sent, use `assertNothingDispatched`.
```php
<?php

use Convenia\Pigeon\Facade\Pigeon;

Pigeon::fake();

Pigeon::dispatch('my-queue', [
'some-data' => 123,
]);

Pigeon::assertNothingDispatched(); // Returns false
```
31 changes: 31 additions & 0 deletions phpunit-ci-old-versions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="false">
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
<testsuite name="Bugs">
<directory prefix="Bug" suffix=".php">./tests/Bugs</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="PIGEON_DRIVER" value="rabbit"/>
<env name="PIGEON_ADDRESS" value="localhost"/>
<env name="PIGEON_PORT" value="5672"/>
<env name="PIGEON_USER" value="guest"/>
<env name="PIGEON_PASSWORD" value="guest"/>
<env name="PIGEON_VHOST" value="/"/>
<env name="PIGEON_KEEPALIVE" value="true"/>
<env name="PIGEON_HEARTBEAT" value="60"/>
</php>
</phpunit>
12 changes: 6 additions & 6 deletions phpunit-ci.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="false">
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
@@ -28,4 +23,9 @@
<env name="PIGEON_KEEPALIVE" value="true"/>
<env name="PIGEON_HEARTBEAT" value="60"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
Loading