joshgaber / NovaUnit

Unit testing suite for Laravel Nova, built to extend PHPUnit
https://joshgaber.github.io/NovaUnit
MIT License
67 stars 23 forks source link

Add type assertion and expose component #62

Open tobias-grasse opened 1 year ago

tobias-grasse commented 1 year ago

Hi @joshgaber, thanks for this handy helper package. I came across the use-case to assert that the defined field has the given Nova field type. Useful e.g. to assert that an E-mail is rendered with the dedicated Laravel\Nova\Fields\Email component instead of a generic Text component.

I've added tests for the new method, as well as an InvalidFieldTypeException to have a nicer error message if the assertion receives an invalid class-string.

I also think that publicly exposing MockComponent::$component might come in handy for cases where we want to perform custom assertions on the actual component rather than the MockComponent. If access is restricted for a reason, I can drop those from the PR.

robertmarney commented 2 months ago

Hey @tobias-grasse

As a head-up this package was marked as abandoned on packagist recently and has been replaced with a new fork (with @joshgaber's blessing)

You can find it here: Packagist and GitHub

Feel free to submit your PR over there 🙏