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

Asserting Action message contents fails #60

Open
Jigsaw5279 opened this issue May 9, 2023 · 2 comments
Open

Asserting Action message contents fails #60

Jigsaw5279 opened this issue May 9, 2023 · 2 comments

Comments

@Jigsaw5279
Copy link

When asserting that an action responds with a specific message, the test case fails with the following error

Failed asserting that Laravel\Nova\Actions\ActionResponse Object #1410 (
    'danger' => null
    'deleted' => null
    'download' => null
    'message' => 'Registrierung bestätigt'
    'name' => null
    'openInNewTab' => null
    'redirect' => null
    'visit' => null
    'modal' => null
    'data' => Array &0 ()
) is of type array and matches the "message" Action response.
/var/www/html/vendor/joshgaber/novaunit/src/Actions/MockActionResponse.php:33
/var/www/html/vendor/joshgaber/novaunit/src/Actions/MockActionResponse.php:47
/var/www/html/tests/Feature/QuickConfirmActionTest.php:154
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:174

Here's the excerpt from the test case

self::novaAction(QuickConfirmAction::class)
            ->handle([], $registration)
            ->assertMessage('Registrierung bestätigt');

Version:

name     : joshgaber/novaunit
descrip. : Unit testing suite for Laravel Nova, built to extend PHPUnit
keywords : joshgaber, laravel, nova, novaunit
versions : * 3.1.0
@greatwitenorth
Copy link

I'm having the same issue. As a workaround for now I'm using:

$response = $action->handle([], [$model]);
$response->assertMessageContains('my message here');

@Jigsaw5279
Copy link
Author

I think PR #59 is related to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants