You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test('blocks creating too many goals', function () {
// make it quicker to testconfig()->set('settings.max_goals', 1);
$user = \App\Models\User::factory()->create();
\App\Events\UserCreatedGoal::commit(
user_id: $user->id,
name: fake()->word,
description: fake()->text(),
);
\App\Events\UserCreatedGoal::commit(
user_id: $user->id,
name: fake()->word,
description: fake()->text(),
);
})
->throws('Validation failed in \'validate\'');
It works but it feels off. Is there a way to set up/seed a state for a test so I don't have to make previous events to check if a validation of an Event will fail as expected?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a good way to test the validation of a state?
For Example I have the following Event:
With the following test:
It works but it feels off. Is there a way to set up/seed a state for a test so I don't have to make previous events to check if a validation of an Event will fail as expected?
Beta Was this translation helpful? Give feedback.
All reactions