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

Custom validation rules #56

Open salvisb opened 1 year ago

salvisb commented 1 year ago

Hi, I'm trying to check for custom validation rule existence, but it doesn't seem to work. Am I missing something?

// resource
Select::make(__('Primary language'), 'locales->primary')
  ...
  ->rules([
      ...,
      new LanguageMustNotOverlapRule(),
  ]),

// tests
$field = $this->resource->field('locales->primary');

$field->assertHasRule(LanguageMustNotOverlapRule::class);

Error: Failed asserting that an array contains 'Domain\Department\Nova\Rules\LanguageMustNotOverlapRule'.