Fix fubscription form failing when some fields are absent or don't exist [MAILPOET-764]

This commit is contained in:
Alexey Stoletniy
2017-01-24 21:12:56 +03:00
parent 9a3c4ff7de
commit bfdc13a8d1
5 changed files with 218 additions and 2 deletions

View File

@ -92,6 +92,26 @@ class FormTest extends MailPoetTest {
expect($form->name)->equals('Updated Form');
}
function testItCanProvideAFieldList() {
$form = Form::createOrUpdate(array(
'name' => 'My Form',
'body' => array(
array(
'type' => 'text',
'id' => 'email',
),
array(
'type' => 'text',
'id' => 2,
),
array(
'type' => 'submit',
'id' => 'submit',
)
)
));
expect($form->getFieldList())->equals(array('email', 'cf_2'));
}
function _after() {
Form::deleteMany();