yoeunes / toastr

:eyes: toastr.js notifications for Laravel
https://php-flasher.io
MIT License
375 stars 52 forks source link

The response is not a view. #42

Closed fonsvalidsign closed 6 months ago

fonsvalidsign commented 6 months ago

Describe the bug In our application, we often assert if the correct view is returned like so:

$response = $this->get(route('index'));

$response->assertOk()
    ->assertViewIs('dashboard.index');

This works with Laravel 9 and your yoeunes/toastr v1, but since upgrading to Laravel 10 and yoeunes/toastr v2 all tests that use assertViewIs now return the following error: The response is not a view.

I think this may be caused by adding the CDN link to flasher in every view.

Sidenote The pages that "don't return a view" do still work as intended.

To Reproduce Steps to reproduce the behaviour:

  1. Make a blank Laravel project (composer create-project laravel/laravel 'project-name')
  2. Change tests/Feature/Exampletext: replace ->assertStatus(200) with ->assertOk()->assertViewIs('welcome').
  3. Run the test, see that this works.
  4. Add yoeunes/toastr v2 to the project (composer require yoeunes/toastr)
  5. Run the test again, see that it fails.

Expected behavior What should otherwise be valid views in Laravel, should not suddenly become invalid, or no views.

Screenshots image

Desktop (please complete the following information):

Severity

yoeunes commented 6 months ago

Hi Fons (@fonsvalidsign) 👋,

Thanks for bringing the issue to my attention!

The fix is now live in yoeunes/toastr v2.3.1. 🚀 Could you please give it a try and let me know if it resolves the view assertion test issue?

If you have any more issues or questions, feel free to reach out.

Best regards, Younes

fonsvalidsign commented 6 months ago

The latest version works, thank you very much!

I've replaced the package with own code for some of the applications that needed to be upgraded, but now I know we can keep using your package with the other applications going forward!