-
Notifications
You must be signed in to change notification settings - Fork 42
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
Flux components automatically fails in phpunit #704
Comments
@cstisa Can you show the actual test file that is triggering the error? |
like I said, it is the file generated from the command line I pastedd earlier. I'm starting to ger crazy because I have no clue where to look for. |
@cstisa I ran Have you just started using Flux? Did you follow all of the installation instructions?: |
Yes @jeffchown , I installed everything properly. And every thing works fine whille navigating on my website. This happens only when testing. I'm trying to investigated further with my project. I'll let you know if I find something. |
@cstisa Did you publish any of the Flux components (e.g. Also, can you confirm it is the CreatePostTest that is causing the error by testing only that file via Have you made any changes to your Working the problem via process of elimination... |
I didn't published any Flux components.
Also, testing via php I also deletedd every other test files on my project just to test this one The only thing is that the error started when I did a (simple) merge with another branch of my git project. It's been too many hours to diagnose the problem, so I decided to start from a commit where everything worked, and I'll add up again one change at a time to determine what's the root cause. |
@cstisa Sounds like a good plan. Good luck! 🤞 |
I found the origin. I'm using Fortify and I wanted to test the
This was my test :
I was mocking the Flux class because otherwise, I would get the following error when doing the
But, when I mocked Flux, the error would disappear and my whole test would success. To conclude, I suppose I have to remove the mocking, but I don't know how to assert that @jeffchown do you have any idea on how to solve my problem please? I'd like to specify that the component calling the update method is a classic Laravel component and not a Livewire component |
@cstisa That's an important piece of information re: you mocking Flux. As for testing Second, if you are calling Toast from within a Livewire component, you should be able to test it via something like this:
(you can see how toast is shown in Past this, I'll have to defer to the expertise of @calebporzio and @joshhanley |
Great, I was worried about my level of comprehension of Laravel, Livewire and Flux, but at least, I new about :
I suppose I won't test the dispatch for this specific case for now. Thanks again @jeffchown and I'll be watching this specific test case in the future 😅 |
You're welcome, @cstisa |
Hi,
I just encountered the problem while doing some tests. For some reason, when a Flux component is in my livewire blade template, it triggers an error whille running the tests.
Step to reproduce :
php artisan make:livewire create-post --test
then in
create-post-blade.php
:then run :
php artisan test
I get this error :
Illuminate\View\ViewException: Call to a member function __call() on null (View: /home/panel/panel/vendor/livewire/flux/stubs/resources/views/flux/button/index.blade.php) (View: /home/panel/panel/vendor/livewire/flux/stubs/resources/views/flux/button/index.blade.php) (View: /home/panel/panel/vendor/livewire/flux/stubs/resources/views/flux/button/index.blade.php)
But I get no error in while loading the page with the component.
this is my phpunit.xml :
Any help with this? I can't find anywhere something similar.
Note : Removing the Flux button allow my test to pass
The text was updated successfully, but these errors were encountered: