Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coding_standards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.4
extensions: mbstring, xml, ctype, iconv, intl
coverage: xdebug

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: Bundle installation
on: push
on: [push, pull_request]

jobs:
integration-tests:
name: Installation in Symfony ${{ matrix.symfony }} with PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
symfony: ['5.4', '6.4', '7.0']
exclude:
- php: '8.1'
symfony: '7.0'
php: ['8.4', '8.5']
symfony: ['6.4', '7.4', '8.0']

steps:
# Setup
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/static_analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Static Analysis
on: [push, pull_request]

jobs:
unit-tests:
name: PHP ${{ matrix.php }} - PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.4', '8.5']

steps:
# Setup
- name: Checkout
uses: actions/checkout@v2

- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, xml, ctype, iconv, intl
coverage: xdebug

# Cache Composer dependencies
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist

# Run PHPStan
- name: Run PHPStan
run: php vendor/bin/phpstan
13 changes: 3 additions & 10 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ on: [push, pull_request]

jobs:
unit-tests:
name: PHP ${{ matrix.php }} - PHPUnit & PHPStan
name: PHPUnit
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.1', '8.2', '8.3']

steps:
# Setup
Expand All @@ -17,7 +14,7 @@ jobs:
- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
php-version: 8.4
extensions: mbstring, xml, ctype, iconv, intl
coverage: xdebug

Expand All @@ -38,8 +35,4 @@ jobs:

# Run tests suite
- name: Run test suite
run: php vendor/bin/simple-phpunit --coverage-text

# Run PHPStan
- name: Run PHPStan
run: php vendor/bin/phpstan
run: php vendor/bin/phpunit
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ 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]
### Added
- Symfony 8 support

### Fixed
- changed TimeToLive broker property to a float: [PR #20](https://github.com/AymDev/MessengerAzureBundle/pull/20)

### Changed
- upgraded minimum supported version to **PHP 8.4** and **Symfony 6.4**

## [2.0.0] - 2024-02-14
### Removed
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: tests
tests:
php ./vendor/bin/simple-phpunit
php ./vendor/bin/phpunit

.PHONY: analysis
analysis:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Messenger Azure Service Bus Bundle
A **PHP 8.1+** & **Symfony 5 / 6 / 7** bundle providing a **Symfony Messenger** *transport* for **Azure Service Bus** using the *Azure REST API*.
A **PHP 8.4+** & **Symfony 6 / 7 / 8** bundle providing a **Symfony Messenger** *transport* for **Azure Service Bus** using the *Azure REST API*.

![Testing](https://github.com/AymDev/MessengerAzureBundle/workflows/Testing/badge.svg)
![Coding Standards](https://github.com/AymDev/MessengerAzureBundle/workflows/Coding%20Standards/badge.svg)
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
"description": "Symfony Messenger bundle for Azure Service Bus",
"type": "symfony-bundle",
"require": {
"php": "^8.1",
"php": "^8.4",
"ext-json": "*",
"symfony/messenger": "^5.4|^6.4|^7.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/http-client": "^5.4|^6.4|^7.0"
"symfony/messenger": "^6.4|^7.4|^8.0",
"symfony/http-kernel": "^6.4|^7.4|^8.0",
"symfony/dependency-injection": "^6.4|^7.4|^8.0",
"symfony/http-client": "^6.4|^7.4|^8.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.6",
"phpstan/phpstan": "^1.4",
"symfony/phpunit-bridge": "^5.4|^6.4|^7.0",
"phpstan/phpstan": "^2.1",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-strict-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.0"
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^13.0"
},
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
- src
- tests
bootstrapFiles:
- vendor/bin/.phpunit/phpunit-9.5-0/vendor/autoload.php
- vendor/autoload.php
ignoreErrors:
- message: '#^Class AymDev\\MessengerAzureBundle\\Messenger\\Transport\\AzureTransportFactory implements generic interface Symfony\\Component\\Messenger\\Transport\\TransportFactoryInterface but does not specify its types\: TTransport$#'
path: src/Messenger/Transport/AzureTransportFactory.php
Expand Down
13 changes: 3 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/13.0/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php">
bootstrap="vendor/autoload.php"
>

<php>
<ini name="error_reporting" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
2 changes: 1 addition & 1 deletion src/Messenger/Exception/SerializerDecodingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class SerializerDecodingException extends MessageDecodingFailedException
/**
* @param Envelope $envelope an envelope with an empty message
*/
public function __construct(Envelope $envelope, string $message = "", int $code = 0, Throwable $previous = null)
public function __construct(Envelope $envelope, string $message = "", int $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
$this->envelope = $envelope;
Expand Down
12 changes: 9 additions & 3 deletions src/Messenger/Transport/AzureTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ public function get(): iterable
);
}

$headers = array_map(
function ($h) {
$last = array_key_last($h);
return null === $last ? null : $h[$last];
},
$headers
);
$headers = array_filter($headers, is_string(...));

// Decode message
try {
$envelope = $this->serializer->decode([
Expand Down Expand Up @@ -158,9 +167,6 @@ public function send(Envelope $envelope): Envelope

// Decode message
$encodedMessage = $this->serializer->encode($envelope);
if (!isset($encodedMessage['body'])) {
throw new \LogicException('Missing encoded message body.', 1644403794);
}
if (isset($encodedMessage['headers'])) {
$additionalHeaders = array_merge($additionalHeaders, $encodedMessage['headers']);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Messenger/Stamp/AzureBrokerPropertiesStampTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Tests\AymDev\MessengerAzureBundle\Messenger\Stamp;

use AymDev\MessengerAzureBundle\Messenger\Stamp\AzureBrokerPropertiesStamp;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
Expand All @@ -13,8 +14,8 @@ final class AzureBrokerPropertiesStampTest extends TestCase
{
/**
* The "BrokerProperties" header and its properties must be optional
* @dataProvider provideMissingBrokerPropertiesResponses
*/
#[DataProvider('provideMissingBrokerPropertiesResponses')]
public function testCreateFromResponseWithMissingProperties(MockResponse $mockResponse): void
{
$httpClient = new MockHttpClient([$mockResponse]);
Expand Down Expand Up @@ -43,7 +44,7 @@ public function testCreateFromResponseWithMissingProperties(MockResponse $mockRe
/**
* @return MockResponse[][]
*/
public function provideMissingBrokerPropertiesResponses(): array
public static function provideMissingBrokerPropertiesResponses(): array
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

use AymDev\MessengerAzureBundle\Messenger\Transport\AzureHttpClientConfigurationBuilder;
use AymDev\MessengerAzureBundle\Messenger\Transport\AzureTransport;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class AzureHttpClientConfigurationBuilderTest extends TestCase
{
/**
* Check default configurations
* @dataProvider provideClientConfiguration
* @param mixed[] $configuration
*/
#[DataProvider('provideClientConfiguration')]
public function testDefaultConfiguration(bool $isSender, array $configuration): void
{
self::assertArrayHasKey('endpoint', $configuration);
Expand All @@ -39,7 +40,7 @@ public function testDefaultConfiguration(bool $isSender, array $configuration):
/**
* @return mixed[][]
*/
public function provideClientConfiguration(): array
public static function provideClientConfiguration(): array
{
$options = [
'shared_access_key_name' => 'KeyName',
Expand Down
6 changes: 3 additions & 3 deletions tests/Messenger/Transport/AzureTransportFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testThrowsOnMissingEntityPath(): void
[
'transport_name' => 'test-transport',
],
self::createMock(SerializerInterface::class)
self::createStub(SerializerInterface::class)
);
}

Expand All @@ -74,7 +74,7 @@ public function testThrowsOnInvalidReceiveMode(): void
'entity_path' => 'entity',
'receive_mode' => 'invalid',
],
self::createMock(SerializerInterface::class)
self::createStub(SerializerInterface::class)
);
}

Expand All @@ -95,7 +95,7 @@ public function testCreateTransport(): void
'transport_name' => 'test-transport',
'entity_path' => 'entity',
],
self::createMock(SerializerInterface::class)
self::createStub(SerializerInterface::class)
);

self::assertInstanceOf(AzureTransport::class, $transport);
Expand Down
Loading
Loading