Skip to content

Commit 9dab0aa

Browse files
authored
Merge pull request mautic#14805 from patrykgruszka/DPMMA-1850_fix-bool-field-default-val-gh52
DPMMA-1850 Fix boolean Field default value
2 parents efb4bc6 + e4cd1d8 commit 9dab0aa

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

app/bundles/LeadBundle/Form/Type/FieldType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
209209
'attr' => ['class' => 'form-control'],
210210
'required' => false,
211211
'mapped' => false,
212-
'data' => '',
213-
'placeholder' => ' x ',
212+
'data' => 0,
214213
]
215214
);
216215

app/bundles/LeadBundle/Tests/Controller/FieldFunctionalTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@ public function dataForCreatingNewBooleanField(): iterable
159159
];
160160
}
161161

162+
public function testCheckDefaultBooleanFieldSetting(): void
163+
{
164+
$crawler = $this->client->request(Request::METHOD_GET, 's/contacts/fields/new');
165+
166+
Assert::assertTrue($this->client->getResponse()->isOk(), $this->client->getResponse()->getContent());
167+
168+
// Check if the radio button with value 0 is checked and value 1 is not
169+
Assert::assertNotNull(
170+
$crawler->filter('#leadfield_default_template_boolean_0')->attr('checked')
171+
);
172+
Assert::assertNull(
173+
$crawler->filter('#leadfield_default_template_boolean_1')->attr('checked')
174+
);
175+
}
176+
162177
/**
163178
* @param array<string, mixed> $parameters
164179
*/

0 commit comments

Comments
 (0)