Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SonataIntegrationBundle] Fix retry message using interface #264

Merged
merged 2 commits into from
May 10, 2024
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/actionlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/after_splitting_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
steps:

- name: Checkout
uses: 'actions/checkout@v2'
uses: 'actions/checkout@v4'

- name: PHP Setup
uses: 'shivammathur/setup-php@v2'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -25,7 +31,7 @@ public function retryAction(
}

$messageBus->dispatch(
new RetryFailedMessageMessage($message->getId())
new RetryFailedMessageMessage($message->getMessageId())
);

$this->addFlash(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
Loading