Skip to content

Commit

Permalink
Fix tests for watermark
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredup committed Mar 7, 2023
1 parent 2f871c6 commit 19e74ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/SettingsBundle/Form/Handler/SettingsFormHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use SolidWorx\FormHandler\FormHandlerSuccessInterface;
use SolidWorx\FormHandler\FormRequest;
use SolidWorx\FormHandler\Options;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -106,7 +107,13 @@ private function getSettings(bool $keepObject = true): array
foreach ($this->settingsRepository->findAll() as $setting) {
$path = '[' . str_replace('/', '][', $setting->getKey()) . ']';

$propertyAccessor->setValue($settings, $path, $keepObject ? $setting : $setting->getValue());
if ($setting->getType() === CheckboxType::class) {
$value = $setting->getValue() === '1';
} else {
$value = $setting->getValue();
}

$propertyAccessor->setValue($settings, $path, $keepObject ? $setting : $value);
}

return $settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ protected function assertOnSuccess(?Response $response, FormRequest $form, $data
'quote' => [
'email_subject' => null,
'bcc_address' => null,
'watermark' => true,
'watermark' => false,
],
'invoice' => [
'email_subject' => null,
'bcc_address' => null,
'watermark' => true,
'watermark' => false,
],
'email' => [
'from_name' => null,
Expand Down

0 comments on commit 19e74ec

Please sign in to comment.