From 1c266630de5e8e1bda8d7d43eab9cf42587cde3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Poirier=20Th=C3=A9or=C3=AAt?= Date: Fri, 10 May 2024 10:39:43 -0400 Subject: [PATCH 1/2] [SonataIntegrationBundle] Fix retry message using interface --- .../Messenger/Controller/MessageController.php | 14 ++++++++++---- .../Action/RetryFailedMessageActionTest.php | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/sonata-integration-bundle/Messenger/Controller/MessageController.php b/packages/sonata-integration-bundle/Messenger/Controller/MessageController.php index d57ae430..b8a3a52d 100644 --- a/packages/sonata-integration-bundle/Messenger/Controller/MessageController.php +++ b/packages/sonata-integration-bundle/Messenger/Controller/MessageController.php @@ -4,17 +4,23 @@ namespace Draw\Bundle\SonataIntegrationBundle\Messenger\Controller; -use App\Entity\MessengerMessage; use Draw\Component\Messenger\Message\RetryFailedMessageMessage; +use Draw\Component\Messenger\Transport\Entity\DrawMessageInterface; use Sonata\AdminBundle\Controller\CRUDController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Messenger\MessageBusInterface; class MessageController extends CRUDController { public function retryAction( - MessengerMessage $message, + Request $request, MessageBusInterface $messageBus - ) { + ): Response { + $message = $this->assertObjectExists($request, true); + + \assert($message instanceof DrawMessageInterface); + if ('failed' !== $message->getQueueName()) { $this->addFlash( 'sonata_flash_error', @@ -25,7 +31,7 @@ public function retryAction( } $messageBus->dispatch( - new RetryFailedMessageMessage($message->getId()) + new RetryFailedMessageMessage($message->getMessageId()) ); $this->addFlash( diff --git a/tests/SonataIntegrationBundle/Messenger/Action/RetryFailedMessageActionTest.php b/tests/SonataIntegrationBundle/Messenger/Action/RetryFailedMessageActionTest.php index a87bbdeb..2a880bac 100644 --- a/tests/SonataIntegrationBundle/Messenger/Action/RetryFailedMessageActionTest.php +++ b/tests/SonataIntegrationBundle/Messenger/Action/RetryFailedMessageActionTest.php @@ -44,11 +44,11 @@ public function testRetry(): void static::$client->request('GET', sprintf('/admin/app/messengermessage/%s/retry', $failedMessage->getId())); + static::assertResponseStatusCodeSame(302); + static::getTransportTester('async') ->assertMessageMatch(RetryFailedMessageMessage::class); - static::assertResponseStatusCodeSame(302); - static::$client->followRedirect(); static::assertSelectorTextContains('.alert-success', 'Retry message successfully dispatched.'); From 284692920370f14df8d365fbcb449b69976d1cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Poirier=20Th=C3=A9or=C3=AAt?= Date: Fri, 10 May 2024 10:43:21 -0400 Subject: [PATCH 2/2] [internal] fix github action checkout and cache version --- .github/workflows/actionlint.yml | 2 +- .github/workflows/after_splitting_test.yaml | 2 +- .github/workflows/build.yml | 4 ++-- .github/workflows/phpcs.yml | 2 +- .github/workflows/phpstan.yml | 2 +- .github/workflows/yamllint.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 3ad1fbc5..30ea23ac 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Actionlint uses: reviewdog/action-actionlint@v1 diff --git a/.github/workflows/after_splitting_test.yaml b/.github/workflows/after_splitting_test.yaml index e39bb7e7..b1de3698 100644 --- a/.github/workflows/after_splitting_test.yaml +++ b/.github/workflows/after_splitting_test.yaml @@ -44,7 +44,7 @@ jobs: steps: - name: Checkout - uses: 'actions/checkout@v2' + uses: 'actions/checkout@v4' - name: PHP Setup uses: 'shivammathur/setup-php@v2' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee60f8d8..c0306ead 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: php-versions: ['8.1', '8.2', '8.3'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -61,7 +61,7 @@ jobs: id: composer-cache run: echo "dir=$(composer config cache-files-dir)" >> "${GITHUB_OUTPUT}" - name: Composer Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-v3-${{ hashFiles('**/composer.lock') }} diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 7c4413ae..223b2ad9 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c20ae779..875d2e11 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml index de8631b9..027d2f8e 100644 --- a/.github/workflows/yamllint.yml +++ b/.github/workflows/yamllint.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Yamllint uses: reviewdog/action-yamllint@v1