claudiodekker / inertia-laravel-testing

Testing helpers for https://github.com/inertiajs/inertia-laravel
MIT License
134 stars 6 forks source link

Orchestra Testbench: Instructions to register Service Provider #8

Closed herpaderpaldent closed 3 years ago

herpaderpaldent commented 3 years ago

For laravel package development orchestra/testbench is often used. Normally the service provider are automatically registered in a laravel app, however in package testing one must manually register the serviceprovider in the getPackageProviders method of the TestCase. Without it, the assertions of this package will not be registered and cause the tests to run into exceptions.

This short information on the installation notes will remind every herp-derp (just like me :smile: ) to not forget to register the ServiceProvider.

If you do not like to have such an explicit instruction, i would advice to note that the ServiceProvider needs to be registered to successfully run tests with the inertia assertions.

claudiodekker commented 3 years ago

Hi,

While I do appreciate this PR, it feels out-of-scope because it's something that's very specific to package development with testbench, as well as something that doesn't exclusively apply to this package but rather applies to every single testing package out there.

Instead, it feels to me like something that would be better suited to be mentioned in the orchestral/testbench documentation, and when taking a look at it, it kind of already is.

With regards to adding a note to the readme: This behavior is already described within Laravel's documentation, and is automatically done since version 5.5. That this doesn't apply to Testbench specific scenarios, again, feels to me more like an issue with the usage of laravel and/or testbench rather than with this package.

Finally, having this PR here I believe will serve as enough of a reference in case someone else will run into a situation like this. In either case, I most likely won't forget about it happening, so even if someone ever opens a new issue about it, I can always refer them to this PR.

Thanks!