* Enable Pro plan - WIP * no pricing page if have no paid plans * Set pricing ids in env * views & submissions FREE for all * extra param for env * form password FREE for all * Custom Code is PRO feature * Replace codeinput prism with codemirror * Better form Cleaning message * Added risky user email spam protection * fix form cleaning * Pricing page new UI * form cleaner * Polish changes * Fixed tests --------- Co-authored-by: Julien Nahum <julien@nahum.net>
42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
use Tests\Helpers\FormSubmissionDataFactory;
|
|
|
|
it('can update form with existing record', function () {
|
|
$user = $this->actingAsProUser();
|
|
$workspace = $this->createUserWorkspace($user);
|
|
$form = $this->createForm($user, $workspace, [
|
|
'editable_submissions' => true,
|
|
]);
|
|
|
|
$nameProperty = collect($form->properties)->filter(function ($property) {
|
|
return $property['name'] == 'Name';
|
|
})->first();
|
|
|
|
$response = $this->postJson(route('forms.answer', $form->slug), [$nameProperty['id'] => 'Testing'])
|
|
->assertSuccessful()
|
|
->assertJson([
|
|
'type' => 'success',
|
|
'message' => 'Form submission saved.',
|
|
]);
|
|
$submissionId = $response->json('submission_id');
|
|
expect($submissionId)->toBeString();
|
|
|
|
if($submissionId){
|
|
$formData = FormSubmissionDataFactory::generateSubmissionData($form, ['submission_id'=>$submissionId, $nameProperty['id'] => 'Testing Updated']);
|
|
$response = $this->postJson(route('forms.answer', $form->slug), $formData)
|
|
->assertSuccessful()
|
|
->assertJson([
|
|
'type' => 'success',
|
|
'message' => 'Form submission saved.',
|
|
]);
|
|
$submissionId2 = $response->json('submission_id');
|
|
expect($submissionId2)->toBeString();
|
|
expect($submissionId2)->toBe($submissionId);
|
|
|
|
$response = $this->getJson(route('forms.fetchSubmission', [$form->slug, $submissionId]))
|
|
->assertSuccessful();
|
|
expect($response->json('data.'.$nameProperty['id']))->toBe('Testing Updated');
|
|
}
|
|
});
|