opnform/tests/Feature/Forms/UpdateWorkspaceSelectOption...

37 lines
1.1 KiB
PHP
Raw Normal View History

2022-09-20 19:59:52 +00:00
<?php
2024-02-23 10:54:12 +00:00
2022-09-20 19:59:52 +00:00
use App\Models\User;
2024-02-23 10:54:12 +00:00
use Tests\Helpers\FormSubmissionDataFactory;
2022-09-20 19:59:52 +00:00
it('can validate Update Workspace Select Option Job', function () {
$user = $this->actingAsUser();
$workspace = $this->createUserWorkspace($user);
$form = $this->createForm($user, $workspace);
$formData = FormSubmissionDataFactory::generateSubmissionData($form);
$this->postJson(route('forms.answer', $form->slug), $formData)
->assertSuccessful()
->assertJson([
'type' => 'success',
2024-02-23 10:54:12 +00:00
'message' => 'Form submission saved.',
2022-09-20 19:59:52 +00:00
]);
$formData = FormSubmissionDataFactory::generateSubmissionData($form);
$this->postJson(route('forms.answer', $form->slug), $formData)
->assertSuccessful()
->assertJson([
'type' => 'success',
2024-02-23 10:54:12 +00:00
'message' => 'Form submission saved.',
2022-09-20 19:59:52 +00:00
]);
});
it('can validate scope with active subscription', function () {
$this->createProUser();
$this->createUser();
$this->createProUser();
$this->createProUser();
$this->createUser();
2024-02-23 10:54:12 +00:00
2022-09-20 19:59:52 +00:00
expect(User::WithActiveSubscription()->count())->toBe(3);
2024-02-23 10:54:12 +00:00
});