-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94f1ff6
commit cc3d9c6
Showing
3 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
APP_ENV=test | ||
DATABASE_URL=mysql://[email protected]:3306/su_form_test?serverVersion=5.7 | ||
DATABASE_URL=mysql://root:ChangeMe@127.0.0.1:3306/su_form_test?serverVersion=5.7 | ||
DATABASE_CHARSET=utf8mb4 | ||
DATABASE_COLLATE=utf8mb4_unicode_ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,6 +206,79 @@ public function testPutFull(): void | |
$this->assertFullForm($response); | ||
} | ||
|
||
public function testPutDuplicatedField(): void | ||
{ | ||
$form = $this->createFullForm(); | ||
$this->client->request( | ||
'PUT', | ||
'/admin/api/forms/' . $form->getId(), | ||
[ | ||
'locale' => 'en', | ||
'title' => 'Title', | ||
'toEmail' => '[email protected]', | ||
'fromEmail' => '[email protected]', | ||
'fields' => [ | ||
[ | ||
'key' => 'email', | ||
'type' => 'email', | ||
'title' => 'Title', | ||
'shortTitle' => 'Short Title', | ||
'placeholder' => 'Placeholder', | ||
'defaultValue' => 'Default Value', | ||
'width' => 'full', | ||
'required' => true, | ||
], | ||
[ | ||
'key' => 'email', // we are testing here if second email field is correctly interpreted as email1 | ||
'type' => 'email', | ||
'title' => 'Title', | ||
'shortTitle' => 'Short Title', | ||
'placeholder' => 'Placeholder', | ||
'defaultValue' => 'Default Value', | ||
'width' => 'full', | ||
'required' => true, | ||
], | ||
[ | ||
'key' => 'email', // we are testing here if second email field is correctly created as email2 | ||
'type' => 'email', | ||
'title' => 'Title', | ||
'shortTitle' => 'Short Title', | ||
'placeholder' => 'Placeholder', | ||
'defaultValue' => 'Default Value', | ||
'width' => 'full', | ||
'required' => true, | ||
], | ||
], | ||
] | ||
); | ||
|
||
$this->assertHttpStatusCode(200, $this->client->getResponse()); | ||
$response = \json_decode($this->client->getResponse()->getContent(), true); | ||
|
||
$respondedFields = []; | ||
foreach ($response['fields'] ?? [] as $field) { | ||
$respondedFields[] = [ | ||
'key' => $field['key'], | ||
'type' => $field['type'], | ||
]; | ||
} | ||
|
||
$this->assertSame([ | ||
[ | ||
'key' => 'email', | ||
'type' => 'email', | ||
], | ||
[ | ||
'key' => 'email1', | ||
'type' => 'email', | ||
], | ||
[ | ||
'key' => 'email2', | ||
'type' => 'email', | ||
], | ||
], $respondedFields); | ||
} | ||
|
||
public function testPutNotExist(): void | ||
{ | ||
$this->client->request( | ||
|