diff --git a/src/Controller/SubscriberController.php b/src/Controller/SubscriberController.php index 94cc775..dc64bdb 100644 --- a/src/Controller/SubscriberController.php +++ b/src/Controller/SubscriberController.php @@ -65,6 +65,7 @@ public function __construct(Authentication $authentication, SubscriberRepository * @OA\JsonContent( * required={"email"}, * @OA\Property(property="email", type="string", format="string", example="admin"), + * @OA\Property(property="extra_data", type="string", format="string", example="extra"), * @OA\Property(property="confirmed", type="string", format="boolean", example="eetIc/Gropvoc1"), * @OA\Property(property="blacklisted", type="string", format="boolean", example="eetIc/Gropvoc1"), * @OA\Property(property="html_entail", type="string", format="boolean", example="eetIc/Gropvoc1"), @@ -131,6 +132,7 @@ public function postAction(Request $request): View $subscriber = new Subscriber(); $subscriber->setEmail($email); + $subscriber->setExtraData($request->get('extra_data')); $subscriber->setConfirmed((bool)$request->get('confirmed')); $subscriber->setBlacklisted((bool)$request->get('blacklisted')); $subscriber->setHtmlEmail((bool)$request->get('html_email')); diff --git a/tests/Integration/Controller/SubscriberControllerTest.php b/tests/Integration/Controller/SubscriberControllerTest.php index 6d2b1ff..16a1009 100644 --- a/tests/Integration/Controller/SubscriberControllerTest.php +++ b/tests/Integration/Controller/SubscriberControllerTest.php @@ -175,8 +175,10 @@ public function postSubscribersWithValidSessionKeyAssignsProvidedSubscriberData( $this->touchDatabaseTable(static::SUBSCRIBER_TABLE_NAME); $email = 'subscriber@example.com'; + $extra = 'extra'; $jsonData = [ 'email' => $email, + 'extra_data' => $extra, 'confirmed' => true, 'blacklisted' => true, 'html_email' => true, @@ -188,6 +190,7 @@ public function postSubscribersWithValidSessionKeyAssignsProvidedSubscriberData( $responseContent = $this->getDecodedJsonResponseContent(); static::assertSame($email, $responseContent['email']); + static::assertSame($extra, $responseContent['extra_data']); static::assertTrue($responseContent['confirmed']); static::assertTrue($responseContent['blacklisted']); static::assertTrue($responseContent['html_email']);