diff --git a/.github/workflows/coding_standards.yaml b/.github/workflows/coding_standards.yaml index 553ec32..c0bb618 100644 --- a/.github/workflows/coding_standards.yaml +++ b/.github/workflows/coding_standards.yaml @@ -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 diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index 1fdf466..8ab435b 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -1,5 +1,5 @@ name: Bundle installation -on: push +on: [push, pull_request] jobs: integration-tests: @@ -7,11 +7,8 @@ jobs: 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 diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml new file mode 100644 index 0000000..c665b03 --- /dev/null +++ b/.github/workflows/static_analysis.yaml @@ -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 diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index b7b2d72..e25455a 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -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 @@ -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 @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1752457..3ff554b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Makefile b/Makefile index acd6628..d03cf24 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: tests tests: - php ./vendor/bin/simple-phpunit + php ./vendor/bin/phpunit .PHONY: analysis analysis: diff --git a/README.md b/README.md index caf743d..d373e8a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/composer.json b/composer.json index 9db96b7..3bc6778 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/phpstan.neon b/phpstan.neon index c2dab7c..13c31a8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -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 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1f2b035..0e6325c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,16 @@ + bootstrap="vendor/autoload.php" +> - - @@ -19,10 +18,4 @@ tests - - - - src - - \ No newline at end of file diff --git a/src/Messenger/Exception/SerializerDecodingException.php b/src/Messenger/Exception/SerializerDecodingException.php index d59e1bc..5cb66fd 100644 --- a/src/Messenger/Exception/SerializerDecodingException.php +++ b/src/Messenger/Exception/SerializerDecodingException.php @@ -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; diff --git a/src/Messenger/Transport/AzureTransport.php b/src/Messenger/Transport/AzureTransport.php index 0effe07..c265cd0 100644 --- a/src/Messenger/Transport/AzureTransport.php +++ b/src/Messenger/Transport/AzureTransport.php @@ -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([ @@ -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']); } diff --git a/tests/Messenger/Stamp/AzureBrokerPropertiesStampTest.php b/tests/Messenger/Stamp/AzureBrokerPropertiesStampTest.php index 97e1cac..f971de3 100644 --- a/tests/Messenger/Stamp/AzureBrokerPropertiesStampTest.php +++ b/tests/Messenger/Stamp/AzureBrokerPropertiesStampTest.php @@ -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; @@ -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]); @@ -43,7 +44,7 @@ public function testCreateFromResponseWithMissingProperties(MockResponse $mockRe /** * @return MockResponse[][] */ - public function provideMissingBrokerPropertiesResponses(): array + public static function provideMissingBrokerPropertiesResponses(): array { return [ [ diff --git a/tests/Messenger/Transport/AzureHttpClientConfigurationBuilderTest.php b/tests/Messenger/Transport/AzureHttpClientConfigurationBuilderTest.php index 25c3dd6..51099d1 100644 --- a/tests/Messenger/Transport/AzureHttpClientConfigurationBuilderTest.php +++ b/tests/Messenger/Transport/AzureHttpClientConfigurationBuilderTest.php @@ -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); @@ -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', diff --git a/tests/Messenger/Transport/AzureTransportFactoryTest.php b/tests/Messenger/Transport/AzureTransportFactoryTest.php index aeb0af4..a94f09d 100644 --- a/tests/Messenger/Transport/AzureTransportFactoryTest.php +++ b/tests/Messenger/Transport/AzureTransportFactoryTest.php @@ -49,7 +49,7 @@ public function testThrowsOnMissingEntityPath(): void [ 'transport_name' => 'test-transport', ], - self::createMock(SerializerInterface::class) + self::createStub(SerializerInterface::class) ); } @@ -74,7 +74,7 @@ public function testThrowsOnInvalidReceiveMode(): void 'entity_path' => 'entity', 'receive_mode' => 'invalid', ], - self::createMock(SerializerInterface::class) + self::createStub(SerializerInterface::class) ); } @@ -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); diff --git a/tests/Messenger/Transport/AzureTransportTest.php b/tests/Messenger/Transport/AzureTransportTest.php index d06d0ee..71c0d01 100644 --- a/tests/Messenger/Transport/AzureTransportTest.php +++ b/tests/Messenger/Transport/AzureTransportTest.php @@ -9,6 +9,7 @@ use AymDev\MessengerAzureBundle\Messenger\Transport\AzureTransport; use AymDev\MessengerAzureBundle\Messenger\Stamp\AzureBrokerPropertiesStamp; use AymDev\MessengerAzureBundle\Messenger\Stamp\AzureReceivedStamp; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; @@ -36,7 +37,7 @@ public function testGetWithHttpCallErrorThrowsTransportException(): void ])); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $httpReceiver, AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -56,7 +57,7 @@ public function testGetWithNoMessage(): void ])); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $httpReceiver, AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -79,7 +80,7 @@ public function testGetWithUnexpectedStatusCode(): void ])); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $httpReceiver, AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -139,8 +140,8 @@ function (string $method, string $url) use ($location): ResponseInterface { /** * Read messages must be returned in an envelope with specific stamps - * @dataProvider provideValidGetCases */ + #[DataProvider('provideValidGetCases')] public function testGetHasStamps( int $statusCode, string $receiveMode, @@ -214,7 +215,7 @@ public function testGetHasStamps( /** * @return array{int, string, bool, ?string, ?string}[] */ - public function provideValidGetCases(): array + public static function provideValidGetCases(): array { return [ [ @@ -250,15 +251,15 @@ public function provideValidGetCases(): array /** * The message acknowledgment or rejection must not do anything on the Receive And Delete receive mode - * @dataProvider provideDeletingMessageMethodNames */ + #[DataProvider('provideDeletingMessageMethodNames')] public function testAckRejectDoesNotDeleteOnReceiveAndDeleteMode(string $methodName): void { $receiver = self::createMock(HttpClientInterface::class); $receiver->expects(self::never())->method('request'); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $receiver, AzureTransport::RECEIVE_MODE_RECEIVE_AND_DELETE, @@ -274,8 +275,8 @@ public function testAckRejectDoesNotDeleteOnReceiveAndDeleteMode(string $methodN /** * The message acknowledgment or rejection must delete using the delete location URL when available - * @dataProvider provideDeletingMessageMethodNames */ + #[DataProvider('provideDeletingMessageMethodNames')] public function testAckRejectDeletesWithDeleteLocationWhenAvailable(string $methodName): void { $expectedUrl = 'https://test-domain-b.com/test-uri-b'; @@ -291,7 +292,7 @@ function (string $method, string $url) use ($expectedUrl): ResponseInterface { ); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $receiver, AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -309,15 +310,15 @@ function (string $method, string $url) use ($expectedUrl): ResponseInterface { /** * An exception must be thrown if there are no delete location nor broker properties - * @dataProvider provideDeletingMessageMethodNames */ + #[DataProvider('provideDeletingMessageMethodNames')] public function testAckRejectWithoutDeleteLocationOrBrokerProperties(string $methodName): void { self::expectException(\LogicException::class); self::expectExceptionCode(1644340687); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), new MockHttpClient(), AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -336,15 +337,15 @@ public function testAckRejectWithoutDeleteLocationOrBrokerProperties(string $met /** * An exception must be thrown if there are no MessageId nor SequenceNumber in the broker properties - * @dataProvider provideDeletingMessageMethodNames */ + #[DataProvider('provideDeletingMessageMethodNames')] public function testAckRejectWithoutBrokerPropertiesMessageIdentifier(string $methodName): void { self::expectException(\LogicException::class); self::expectExceptionCode(1644340921); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), new MockHttpClient(), AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -363,8 +364,8 @@ public function testAckRejectWithoutBrokerPropertiesMessageIdentifier(string $me /** * An exception must be thrown if there is a MessageId or SequenceNumber but no LockToken in the broker properties - * @dataProvider provideBrokerPropertiesWithMissingLockToken */ + #[DataProvider('provideBrokerPropertiesWithMissingLockToken')] public function testAckRejectWithoutBrokerPropertiesLockToken( string $methodName, AzureBrokerPropertiesStamp $stamp @@ -373,7 +374,7 @@ public function testAckRejectWithoutBrokerPropertiesLockToken( self::expectExceptionCode(1644340926); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), new MockHttpClient(), AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -391,7 +392,7 @@ public function testAckRejectWithoutBrokerPropertiesLockToken( /** * @return array{string, AzureBrokerPropertiesStamp}[] */ - public function provideBrokerPropertiesWithMissingLockToken(): iterable + public static function provideBrokerPropertiesWithMissingLockToken(): iterable { $stamps = [ new AzureBrokerPropertiesStamp( @@ -418,7 +419,7 @@ public function provideBrokerPropertiesWithMissingLockToken(): iterable ) ]; - foreach ($this->provideDeletingMessageMethodNames() as [$methodName]) { + foreach (self::provideDeletingMessageMethodNames() as [$methodName]) { foreach ($stamps as $stamp) { yield [ $methodName, @@ -431,8 +432,8 @@ public function provideBrokerPropertiesWithMissingLockToken(): iterable /** * The message acknowledgment or rejection must delete using the BrokerProperties when there is no delete location * but there is a message identifier and LockToken - * @dataProvider provideDeletingMessageMethodNames */ + #[DataProvider('provideDeletingMessageMethodNames')] public function testAckRejectDeletesWithBrokerProperties(string $methodName): void { $messageId = 'test-message-id'; @@ -452,7 +453,7 @@ function (string $method, string $url) use ($expectedUrl): ResponseInterface { ); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $receiver, AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -479,8 +480,8 @@ function (string $method, string $url) use ($expectedUrl): ResponseInterface { /** * An exception from the HTTP client during the message acknowledgment or rejection must be converted to a transport * exception - * @dataProvider provideDeletingMessageMethodNames */ + #[DataProvider('provideDeletingMessageMethodNames')] public function testAckRejectThrowsOnHttpError(string $methodName): void { self::expectException(TransportException::class); @@ -491,7 +492,7 @@ public function testAckRejectThrowsOnHttpError(string $methodName): void ])); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), + self::createStub(SerializerInterface::class), new MockHttpClient(), $receiver, AzureTransport::RECEIVE_MODE_PEEK_LOCK, @@ -510,7 +511,7 @@ public function testAckRejectThrowsOnHttpError(string $methodName): void /** * @return string[][] */ - public function provideDeletingMessageMethodNames(): array + public static function provideDeletingMessageMethodNames(): array { return [ ['ack'], @@ -603,34 +604,7 @@ public function testSendWithBrokerPropertiesJsonErrorThrowsTransportException(): ]); $transport = new AzureTransport( - self::createMock(SerializerInterface::class), - new MockHttpClient(), - new MockHttpClient(), - AzureTransport::RECEIVE_MODE_RECEIVE_AND_DELETE, - 'entity' - ); - - $transport->send($envelope); - } - - /** - * The encoded enveloppe must have a "body" key - */ - public function testSentEncodedEnvelopeMustHaveABody(): void - { - self::expectException(\LogicException::class); - self::expectExceptionCode(1644403794); - - $envelope = new Envelope(new class {}); - - $serializer = self::createMock(SerializerInterface::class); - $serializer->expects(self::once()) - ->method('encode') - ->with($envelope) - ->willReturn([]); - - $transport = new AzureTransport( - $serializer, + self::createStub(SerializerInterface::class), new MockHttpClient(), new MockHttpClient(), AzureTransport::RECEIVE_MODE_RECEIVE_AND_DELETE, diff --git a/tests/Messenger/Transport/DsnParserTest.php b/tests/Messenger/Transport/DsnParserTest.php index 24f4e91..90d08b1 100644 --- a/tests/Messenger/Transport/DsnParserTest.php +++ b/tests/Messenger/Transport/DsnParserTest.php @@ -5,6 +5,7 @@ namespace Tests\AymDev\MessengerAzureBundle\Messenger\Transport; use AymDev\MessengerAzureBundle\Messenger\Transport\DsnParser; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class DsnParserTest extends TestCase @@ -44,10 +45,10 @@ public static function provideValidConfigurations(): iterable } /** - * @dataProvider provideValidConfigurations * @param mixed[] $options * @param mixed[] $expectedResult */ + #[DataProvider('provideValidConfigurations')] public function testParseValidDsn(string $dsn, array $options, array $expectedResult): void { $parser = new DsnParser(); @@ -79,7 +80,7 @@ public function testDsnOptionsAreUrlDecoded(): void /** * @return iterable */ - public function provideMergingOrderTestData(): iterable + public static function provideMergingOrderTestData(): iterable { yield 'dsn options' => [ 'dsn' => 'azure://key-name:key-value@namespace-name?entity_path=entity-path&token_expiry=7200', @@ -121,16 +122,16 @@ public function provideMergingOrderTestData(): iterable } /** - * @dataProvider provideMergingOrderTestData * @param mixed[] $options - * @param mixed[] $expectedResult + * @param mixed[] $expected */ - public function testOptionsMergingOrder(string $dsn, array $options, array $expectedResult): void + #[DataProvider('provideMergingOrderTestData')] + public function testOptionsMergingOrder(string $dsn, array $options, array $expected): void { $parser = new DsnParser(); $result = $parser->parseDsn($dsn, $options, 'my-transport'); - self::assertSame($expectedResult, $result); + self::assertSame($expected, $result); } /** @@ -284,20 +285,20 @@ public static function provideInvalidConfigurations(): iterable } /** - * @dataProvider provideInvalidConfigurations * @param mixed[] $options */ + #[DataProvider('provideInvalidConfigurations')] public function testInvalidConfigThrowsException( string $dsn, array $options, - string $expectedError, - int $expectedCode = 0 + string $error, + int $code = 0 ): void { $parser = new DsnParser(); $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage($expectedError); - $this->expectExceptionCode($expectedCode); + $this->expectExceptionMessage($error); + $this->expectExceptionCode($code); $parser->parseDsn($dsn, $options, 'my-transport'); }