add constants
Cette révision appartient à :
Parent
0110a3b7b9
révision
549078f1b7
@ -75,7 +75,7 @@ class Connection
|
||||
*/
|
||||
public function getClient(): ClientInterface
|
||||
{
|
||||
$this->client ??=
|
||||
$this->client ??=
|
||||
new Client([
|
||||
'base_uri' => self::URL,
|
||||
'headers' => [
|
||||
@ -145,6 +145,7 @@ class Connection
|
||||
$response->getBody()->rewind();
|
||||
|
||||
$response_body = $response->getBody()->getContents();
|
||||
|
||||
$result_array = json_decode($response_body, true);
|
||||
|
||||
if ($response->getStatusCode() === 204) {
|
||||
|
@ -36,17 +36,17 @@ class Subscriber extends ArrayCollection
|
||||
|
||||
public function getId(): ?string
|
||||
{
|
||||
return $this->get('id');
|
||||
return $this->get(SubscriberEndpoint::ID);
|
||||
}
|
||||
|
||||
public function getListId(): ?string
|
||||
{
|
||||
return $this->get('listid');
|
||||
return $this->get(SubscriberEndpoint::LISTID);
|
||||
}
|
||||
|
||||
public function getOptinTime(): ?DateTime
|
||||
{
|
||||
return $this->getDateTimeFromValue($this->get('optin'));
|
||||
return $this->getDateTimeFromValue($this->get(SubscriberEndpoint::OPTIN));
|
||||
}
|
||||
|
||||
public function isOptedIn(): bool
|
||||
@ -58,24 +58,24 @@ class Subscriber extends ArrayCollection
|
||||
|
||||
public function getOptinIp(): ?string
|
||||
{
|
||||
return $this->get('optin_ip');
|
||||
return $this->get(SubscriberEndpoint::OPTIN_IP);
|
||||
}
|
||||
|
||||
public function getEmailAddress(): ?string
|
||||
{
|
||||
return $this->get('email');
|
||||
return $this->get(SubscriberEndpoint::EMAIL);
|
||||
}
|
||||
|
||||
public function changeEmailAddress(string $emailAddress): void
|
||||
{
|
||||
$this->set('email', $emailAddress);
|
||||
$this->set(SubscriberEndpoint::EMAIL, $emailAddress);
|
||||
|
||||
// use persist method to send to Klicktipp
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
return $this->get(SubscriberEndpoint::STATUS);
|
||||
}
|
||||
|
||||
public function isSubscribed(): bool
|
||||
@ -85,7 +85,7 @@ class Subscriber extends ArrayCollection
|
||||
|
||||
public function getBounce(): ?string
|
||||
{
|
||||
return $this->get('bounce');
|
||||
return $this->get(SubscriberEndpoint::BOUNCE);
|
||||
}
|
||||
|
||||
public function isBounced(): bool
|
||||
@ -95,64 +95,64 @@ class Subscriber extends ArrayCollection
|
||||
|
||||
public function getDate(): ?DateTime
|
||||
{
|
||||
return $this->getDateTimeFromValue($this->get('date'));
|
||||
return $this->getDateTimeFromValue($this->get(SubscriberEndpoint::DATE));
|
||||
}
|
||||
|
||||
public function getIp(): ?string
|
||||
{
|
||||
return $this->get('ip');
|
||||
return $this->get(SubscriberEndpoint::IP);
|
||||
}
|
||||
|
||||
public function getUnsubscription(): ?DateTime
|
||||
{
|
||||
return $this->getDateTimeFromValue($this->get('unsubscription'));
|
||||
return $this->getDateTimeFromValue($this->get(SubscriberEndpoint::UNSUBSCRIPTION));
|
||||
}
|
||||
|
||||
public function getUnsubscriptionIp(): ?string
|
||||
{
|
||||
return $this->get('unsubscription_ip');
|
||||
return $this->get(SubscriberEndpoint::UNSUBSCRIPTION_IP);
|
||||
}
|
||||
|
||||
public function getReferrer(): ?string
|
||||
{
|
||||
return $this->get('referrer');
|
||||
return $this->get(SubscriberEndpoint::REFERRER);
|
||||
}
|
||||
|
||||
public function getSmsPhone(): ?string
|
||||
{
|
||||
return $this->get('sms_phone');
|
||||
return $this->get(SubscriberEndpoint::SMS_PHONE);
|
||||
}
|
||||
|
||||
public function setSmsPhone(string $smsPhone): void
|
||||
{
|
||||
$this->set('sms_phone', $smsPhone);
|
||||
$this->set(SubscriberEndpoint::SMS_PHONE, $smsPhone);
|
||||
|
||||
// use persist method to send to Klicktipp
|
||||
}
|
||||
|
||||
public function getSmsStatus(): ?string
|
||||
{
|
||||
return $this->get('sms_status');
|
||||
return $this->get(SubscriberEndpoint::SMS_STATUS);
|
||||
}
|
||||
|
||||
public function getSmsBounce(): ?string
|
||||
{
|
||||
return $this->get('sms_bounce');
|
||||
return $this->get(SubscriberEndpoint::SMS_BOUNCE);
|
||||
}
|
||||
|
||||
public function getSmsDate(): ?DateTime
|
||||
{
|
||||
return $this->getDateTimeFromValue($this->get('sms_date'));
|
||||
return $this->getDateTimeFromValue($this->get(SubscriberEndpoint::SMS_DATE));
|
||||
}
|
||||
|
||||
public function getSmsUnsubscription(): ?string
|
||||
{
|
||||
return $this->getDateTimeFromValue($this->get('sms_unsubscription'));
|
||||
return $this->getDateTimeFromValue($this->get(SubscriberEndpoint::SMS_UNSUBSCRIPTION));
|
||||
}
|
||||
|
||||
public function getSmsReferrer(): ?string
|
||||
{
|
||||
return $this->get('sms_referrer');
|
||||
return $this->get(SubscriberEndpoint::SMS_REFERRER);
|
||||
}
|
||||
|
||||
public function getFields(): ArrayCollection
|
||||
@ -183,7 +183,7 @@ class Subscriber extends ArrayCollection
|
||||
|
||||
public function getTags(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('tags') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::TAGS) ?? []);
|
||||
}
|
||||
|
||||
public function isTagSet(string $tagId): bool
|
||||
@ -195,7 +195,7 @@ class Subscriber extends ArrayCollection
|
||||
{
|
||||
$tags = $this->getTags();
|
||||
$tags->clear();
|
||||
$this->set('tags', $tags->toArray());
|
||||
$this->set(SubscriberEndpoint::TAGS, $tags->toArray());
|
||||
|
||||
// use persist method to send to Klicktipp
|
||||
}
|
||||
@ -204,7 +204,7 @@ class Subscriber extends ArrayCollection
|
||||
{
|
||||
$tags = $this->getTags();
|
||||
$tags->add($tagId);
|
||||
$this->set('tags', $tags->toArray());
|
||||
$this->set(SubscriberEndpoint::TAGS, $tags->toArray());
|
||||
|
||||
// use persist method to send to Klicktipp
|
||||
}
|
||||
@ -213,7 +213,7 @@ class Subscriber extends ArrayCollection
|
||||
{
|
||||
$tags = $this->getTags();
|
||||
$tags->removeElement($tagId);
|
||||
$this->set('tags', $tags->toArray());
|
||||
$this->set(SubscriberEndpoint::TAGS, $tags->toArray());
|
||||
|
||||
// use persist method to send to Klicktipp
|
||||
}
|
||||
@ -223,7 +223,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getManualTags(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('manual_tags') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::MANUALTAGS) ?? []);
|
||||
}
|
||||
|
||||
public function isManualTagSet(string $tagId): bool
|
||||
@ -238,7 +238,7 @@ class Subscriber extends ArrayCollection
|
||||
|
||||
public function getSmartTags(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('smart_tags') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::SMARTTAGS) ?? []);
|
||||
}
|
||||
|
||||
public function getSmartTagTime(string $tagId): ?DateTime
|
||||
@ -251,7 +251,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getStartedCampaigns(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('campaigns_started') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::CAMPAIGNSSTARTED) ?? []);
|
||||
}
|
||||
|
||||
public function getStartedCampaignTime(string $campaignId): ?DateTime
|
||||
@ -264,7 +264,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getFinishedCampaigns(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('campaigns_finished') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::CAMPAIGNSFINISHED) ?? []);
|
||||
}
|
||||
|
||||
public function getFinishedCampaignTime(string $campaignId): ?DateTime
|
||||
@ -277,7 +277,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getSentNotificationEmails(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('notification_emails_sent') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::NOTIFICATIONEMAILSSENT) ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,7 +285,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getOpenedNotificationEmails(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('notification_emails_opened') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::NOTIFICATIONEMAILSOPENED) ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -293,7 +293,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getClickedNotificationEmails(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('notification_emails_clicked') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::NOTIFICATIONEMAILSCLICKED) ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,7 +301,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getViewedNotificationEmails(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('notification_emails_viewed') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::NOTIFICATIONEMAILSVIEWED) ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,7 +309,7 @@ class Subscriber extends ArrayCollection
|
||||
*/
|
||||
public function getOutbounds(): ArrayCollection
|
||||
{
|
||||
return new ArrayCollection($this->get('outbound') ?? []);
|
||||
return new ArrayCollection($this->get(SubscriberEndpoint::OUTBOUND) ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,58 @@ use GuzzleHttp\RequestOptions;
|
||||
|
||||
class Subscriber extends Model
|
||||
{
|
||||
public const ID = 'id';
|
||||
public const LISTID = 'listid';
|
||||
public const OPTIN = 'optin';
|
||||
public const OPTIN_IP = 'optin_ip';
|
||||
public const EMAIL = 'email';
|
||||
public const STATUS = 'status';
|
||||
public const BOUNCE = 'bounce';
|
||||
public const IP = 'ip';
|
||||
public const UNSUBSCRIPTION = 'unsubscription';
|
||||
public const UNSUBSCRIPTION_IP = 'unsubscription_ip';
|
||||
public const SMS_PHONE = 'sms_phone';
|
||||
public const SMS_STATUS = 'sms_status';
|
||||
public const SMS_BOUNCE = 'sms_bounce';
|
||||
public const SMS_DATE = 'sms_date';
|
||||
public const SMS_UNSUBSCRIPTION = 'sms_unsubscription';
|
||||
public const SMS_REFERRER = 'sms_referrer';
|
||||
public const REFERRER = 'referrer';
|
||||
public const DATE = 'date';
|
||||
public const FIELD_FIRSTNAME = 'fieldFirstName';
|
||||
public const FIELD_LASTNAME = 'fieldLastName';
|
||||
public const FIELD_COMPANYNAME = 'fieldCompanyName';
|
||||
public const FIELD_STREET1 = 'fieldStreet1';
|
||||
public const FIELD_STREET2 = 'fieldStreet2';
|
||||
public const FIELD_CITY = 'fieldCity';
|
||||
public const FIELD_STATE = 'fieldState';
|
||||
public const FIELD_ZIP = 'fieldZip';
|
||||
public const FIELD_COUNTRY = 'fieldCountry';
|
||||
public const FIELD_PRIVATEPHONE = 'fieldPrivatePhone';
|
||||
public const FIELD_MOBILEPHONE = 'fieldMobilePhone';
|
||||
public const FIELD_PHONE = 'fieldPhone';
|
||||
public const FIELD_FAX = 'fieldFax';
|
||||
public const FIELD_WEBSITE = 'fieldWebsite';
|
||||
public const FIELD_BIRTHDAY = 'fieldBirthday';
|
||||
public const FIELD_LEADVALUE = 'fieldLeadValue';
|
||||
public const TAGS = 'tags';
|
||||
public const MANUALTAGS = 'manual_tags';
|
||||
public const SMARTTAGS = 'smart_tags';
|
||||
public const CAMPAIGNSSTARTED = 'campaigns_started';
|
||||
public const CAMPAIGNSFINISHED = 'campaigns_finished';
|
||||
public const NOTIFICATIONEMAILSSENT = 'notification_emails_sent';
|
||||
public const NOTIFICATIONEMAILSOPENED = 'notification_emails_opened';
|
||||
public const NOTIFICATIONEMAILSCLICKED = 'notification_emails_clicked';
|
||||
public const NOTIFICATIONEMAILSVIEWED = 'notification_emails_viewed';
|
||||
public const OUTBOUND = 'outbound';
|
||||
public const PARAM_TAGID = 'tagid';
|
||||
public const PARAM_TAGIDS = 'tagids';
|
||||
public const PARAM_FIELDS = 'fields';
|
||||
public const PARAM_SMS_NUMBER = 'smsnumber';
|
||||
public const PARAM_NEW_EMAIL = 'newemail';
|
||||
public const PARAM_NEW_SMSNUMBER = 'newsmsnumber';
|
||||
public const PARAM_APIKEY = 'apikey';
|
||||
|
||||
/**
|
||||
* @throws BaseException
|
||||
*/
|
||||
@ -59,7 +111,7 @@ class Subscriber extends Model
|
||||
'subscriber/search.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress),
|
||||
self::EMAIL => trim($mailAddress),
|
||||
],
|
||||
]
|
||||
)
|
||||
@ -83,13 +135,13 @@ class Subscriber extends Model
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => array_filter(
|
||||
[
|
||||
'email' => trim($mailAddress),
|
||||
'listid' => trim($listId ?? ''),
|
||||
'tagid' => trim($tagId ?? ''),
|
||||
'fields' => array_filter(
|
||||
self::EMAIL => trim($mailAddress),
|
||||
self::LISTID => trim($listId ?? ''),
|
||||
self::PARAM_TAGID => trim($tagId ?? ''),
|
||||
self::PARAM_FIELDS => array_filter(
|
||||
array_map('trim', $fields ?? [])
|
||||
),
|
||||
'smsnumber' => trim($smsNumber ?? ''),
|
||||
self::PARAM_SMS_NUMBER => trim($smsNumber ?? ''),
|
||||
]
|
||||
),
|
||||
]
|
||||
@ -108,7 +160,7 @@ class Subscriber extends Model
|
||||
'subscriber/unsubscribe.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress),
|
||||
self::EMAIL => trim($mailAddress),
|
||||
],
|
||||
]
|
||||
)
|
||||
@ -128,8 +180,8 @@ class Subscriber extends Model
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => array_filter(
|
||||
[
|
||||
'email' => trim($mailAddress),
|
||||
'tagids' => array_filter(
|
||||
self::EMAIL => trim($mailAddress),
|
||||
self::PARAM_TAGIDS => array_filter(
|
||||
array_map('trim', $tagIds)
|
||||
),
|
||||
]
|
||||
@ -151,8 +203,8 @@ class Subscriber extends Model
|
||||
'subscriber/untag.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress),
|
||||
'tagid' => trim($tagId),
|
||||
self::EMAIL => trim($mailAddress),
|
||||
self::PARAM_TAGID => trim($tagId),
|
||||
],
|
||||
]
|
||||
)
|
||||
@ -169,7 +221,7 @@ class Subscriber extends Model
|
||||
'subscriber/tagged.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'tagid' => trim($tagId),
|
||||
self::PARAM_TAGID => trim($tagId),
|
||||
],
|
||||
]
|
||||
) ?? [];
|
||||
@ -191,9 +243,9 @@ class Subscriber extends Model
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => array_filter(
|
||||
[
|
||||
'newemail' => trim($newEmail ?? ''),
|
||||
'newsmsnumber' => trim($newSmsNumber ?? ''),
|
||||
'fields' => array_filter(
|
||||
self::PARAM_NEW_EMAIL => trim($newEmail ?? ''),
|
||||
self::PARAM_NEW_SMSNUMBER => trim($newSmsNumber ?? ''),
|
||||
self::PARAM_FIELDS => array_filter(
|
||||
array_map('trim', $fields ?? [])
|
||||
),
|
||||
]
|
||||
@ -233,10 +285,10 @@ class Subscriber extends Model
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => array_filter(
|
||||
[
|
||||
'apikey' => trim($apikey),
|
||||
'email' => trim($emailAddress),
|
||||
'smsnumber' => trim($smsNumber ?? ''),
|
||||
'fields' => array_filter(
|
||||
self::PARAM_APIKEY => trim($apikey),
|
||||
self::EMAIL => trim($emailAddress),
|
||||
self::PARAM_SMS_NUMBER => trim($smsNumber ?? ''),
|
||||
self::PARAM_FIELDS => array_filter(
|
||||
array_map('trim', $fields ?? [])
|
||||
),
|
||||
]
|
||||
@ -257,8 +309,8 @@ class Subscriber extends Model
|
||||
'subscriber/signout.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'apikey' => trim($apikey),
|
||||
'email' => trim($emailAddress),
|
||||
self::PARAM_APIKEY => trim($apikey),
|
||||
self::EMAIL => trim($emailAddress),
|
||||
],
|
||||
]
|
||||
)
|
||||
@ -276,8 +328,8 @@ class Subscriber extends Model
|
||||
'subscriber/signoff.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'apikey' => trim($apikey),
|
||||
'email' => trim($emailAddress),
|
||||
self::PARAM_APIKEY => trim($apikey),
|
||||
self::EMAIL => trim($emailAddress),
|
||||
],
|
||||
]
|
||||
)
|
||||
|
@ -48,6 +48,24 @@ class SubscriptionProcess extends Model
|
||||
return new SubscriptionEntity($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException
|
||||
*/
|
||||
public function update(string $listId, ?string $name): bool
|
||||
{
|
||||
return (bool) current(
|
||||
$this->connection->requestAndParse(
|
||||
'PUT',
|
||||
'list/'.urlencode(trim($listId)).'.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => array_filter([
|
||||
'name' => trim($name ?? ''),
|
||||
]),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException
|
||||
*/
|
||||
|
@ -22,6 +22,10 @@ use GuzzleHttp\RequestOptions;
|
||||
|
||||
class Tag extends Model
|
||||
{
|
||||
public const ID = 'tagid';
|
||||
public const NAME = 'name';
|
||||
public const TEXT = 'text';
|
||||
|
||||
/**
|
||||
* @throws BaseException
|
||||
*/
|
||||
@ -60,7 +64,7 @@ class Tag extends Model
|
||||
'tag.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'name' => trim($name),
|
||||
self::NAME => trim($name),
|
||||
],
|
||||
]
|
||||
)
|
||||
@ -78,8 +82,8 @@ class Tag extends Model
|
||||
'tag/'.urlencode(trim($tagId)).'.json',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => array_filter([
|
||||
'name' => trim($name ?? ''),
|
||||
'text' => trim($text ?? ''),
|
||||
self::NAME => trim($name ?? ''),
|
||||
self::TEXT => trim($text ?? ''),
|
||||
]),
|
||||
]
|
||||
)
|
||||
|
@ -18,6 +18,7 @@ namespace D3\KlicktippPhpClient\tests\integration\Resources;
|
||||
use D3\KlicktippPhpClient\Entities\FieldList;
|
||||
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
||||
use D3\KlicktippPhpClient\Resources\Field;
|
||||
use D3\KlicktippPhpClient\Resources\Subscriber;
|
||||
use D3\KlicktippPhpClient\tests\integration\IntegrationTestCase;
|
||||
use Generator;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
@ -55,39 +56,39 @@ class FieldTest extends IntegrationTestCase
|
||||
public static function indexDataProvider(): Generator
|
||||
{
|
||||
yield 'success' => [new Response(200, [], '{
|
||||
"fieldFirstName": "Vorname",
|
||||
"fieldLastName": "Nachname",
|
||||
"fieldCompanyName": "Firma",
|
||||
"fieldStreet1": "Straße 1",
|
||||
"fieldStreet2": "Straße 2",
|
||||
"fieldCity": "Stadt",
|
||||
"fieldState": "Bundesland",
|
||||
"fieldZip": "Postleitzahl",
|
||||
"fieldCountry": "Land",
|
||||
"fieldPrivatePhone": "Telefon (Privat)",
|
||||
"fieldMobilePhone": "Telefon (Mobil)",
|
||||
"fieldPhone": "Telefon",
|
||||
"fieldFax": "Fax",
|
||||
"fieldWebsite": "Website",
|
||||
"fieldBirthday": "Geburtstag",
|
||||
"fieldLeadValue": "LeadValue"
|
||||
"'.Subscriber::FIELD_FIRSTNAME.'": "Vorname",
|
||||
"'.Subscriber::FIELD_LASTNAME.'": "Nachname",
|
||||
"'.Subscriber::FIELD_COMPANYNAME.'": "Firma",
|
||||
"'.Subscriber::FIELD_STREET1.'": "Straße 1",
|
||||
"'.Subscriber::FIELD_STREET2.'": "Straße 2",
|
||||
"'.Subscriber::FIELD_CITY.'": "Stadt",
|
||||
"'.Subscriber::FIELD_STATE.'": "Bundesland",
|
||||
"'.Subscriber::FIELD_ZIP.'": "Postleitzahl",
|
||||
"'.Subscriber::FIELD_COUNTRY.'": "Land",
|
||||
"'.Subscriber::FIELD_PRIVATEPHONE.'": "Telefon (Privat)",
|
||||
"'.Subscriber::FIELD_MOBILEPHONE.'": "Telefon (Mobil)",
|
||||
"'.Subscriber::FIELD_PHONE.'": "Telefon",
|
||||
"'.Subscriber::FIELD_FAX.'": "Fax",
|
||||
"'.Subscriber::FIELD_WEBSITE.'": "Website",
|
||||
"'.Subscriber::FIELD_BIRTHDAY.'": "Geburtstag",
|
||||
"'.Subscriber::FIELD_LEADVALUE.'": "LeadValue"
|
||||
}'), new FieldList([
|
||||
"fieldFirstName" => "Vorname",
|
||||
"fieldLastName" => "Nachname",
|
||||
"fieldCompanyName" => "Firma",
|
||||
"fieldStreet1" => "Straße 1",
|
||||
"fieldStreet2" => "Straße 2",
|
||||
"fieldCity" => "Stadt",
|
||||
"fieldState" => "Bundesland",
|
||||
"fieldZip" => "Postleitzahl",
|
||||
"fieldCountry" => "Land",
|
||||
"fieldPrivatePhone" => "Telefon (Privat)",
|
||||
"fieldMobilePhone" => "Telefon (Mobil)",
|
||||
"fieldPhone" => "Telefon",
|
||||
"fieldFax" => "Fax",
|
||||
"fieldWebsite" => "Website",
|
||||
"fieldBirthday" => "Geburtstag",
|
||||
"fieldLeadValue" => "LeadValue",
|
||||
Subscriber::FIELD_FIRSTNAME => "Vorname",
|
||||
Subscriber::FIELD_LASTNAME => "Nachname",
|
||||
Subscriber::FIELD_COMPANYNAME => "Firma",
|
||||
Subscriber::FIELD_STREET1 => "Straße 1",
|
||||
Subscriber::FIELD_STREET2 => "Straße 2",
|
||||
Subscriber::FIELD_CITY => "Stadt",
|
||||
Subscriber::FIELD_STATE => "Bundesland",
|
||||
Subscriber::FIELD_ZIP => "Postleitzahl",
|
||||
Subscriber::FIELD_COUNTRY => "Land",
|
||||
Subscriber::FIELD_PRIVATEPHONE => "Telefon (Privat)",
|
||||
Subscriber::FIELD_MOBILEPHONE => "Telefon (Mobil)",
|
||||
Subscriber::FIELD_PHONE => "Telefon",
|
||||
Subscriber::FIELD_FAX => "Fax",
|
||||
Subscriber::FIELD_WEBSITE => "Website",
|
||||
Subscriber::FIELD_BIRTHDAY => "Geburtstag",
|
||||
Subscriber::FIELD_LEADVALUE => "LeadValue",
|
||||
])];
|
||||
yield 'wrong request type' => [new Response(406, [], '["Bei der Erstellung des Objekt ist ein Fehler aufgetreten."]'), null, true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
|
@ -116,75 +116,75 @@ class SubscriberTest extends IntegrationTestCase
|
||||
public static function getDataProvider(): Generator
|
||||
{
|
||||
yield 'success' => [new Response(200, [], '{
|
||||
"id": "155988456",
|
||||
"listid": "368370",
|
||||
"optin": "28.12.2024 22:52:09",
|
||||
"optin_ip": "0.0.0.0 - By API Request",
|
||||
"email": "testsubscriber@mydomain.com",
|
||||
"status": "Opt-In Pending",
|
||||
"bounce": "Not Bounced",
|
||||
"date": "",
|
||||
"ip": "0.0.0.0 - By API Request",
|
||||
"unsubscription": "",
|
||||
"unsubscription_ip": "0.0.0.0",
|
||||
"referrer": "",
|
||||
"sms_phone": null,
|
||||
"sms_status": null,
|
||||
"sms_bounce": null,
|
||||
"sms_date": "",
|
||||
"sms_unsubscription": "",
|
||||
"sms_referrer": null,
|
||||
"fieldFirstName": "",
|
||||
"fieldLastName": "",
|
||||
"fieldCompanyName": "",
|
||||
"fieldStreet1": "",
|
||||
"fieldStreet2": "",
|
||||
"fieldCity": "",
|
||||
"fieldState": "",
|
||||
"fieldZip": "",
|
||||
"fieldCountry": "",
|
||||
"fieldPrivatePhone": "",
|
||||
"fieldMobilePhone": "",
|
||||
"fieldPhone": "",
|
||||
"fieldFax": "",
|
||||
"fieldWebsite": "",
|
||||
"fieldBirthday": "",
|
||||
"fieldLeadValue": ""
|
||||
"'.Subscriber::ID.'": "155988456",
|
||||
"'.Subscriber::LISTID.'": "368370",
|
||||
"'.Subscriber::OPTIN.'": "28.12.2024 22:52:09",
|
||||
"'.Subscriber::OPTIN_IP.'": "0.0.0.0 - By API Request",
|
||||
"'.Subscriber::EMAIL.'": "testsubscriber@mydomain.com",
|
||||
"'.Subscriber::STATUS.'": "Opt-In Pending",
|
||||
"'.Subscriber::BOUNCE.'": "Not Bounced",
|
||||
"'.Subscriber::DATE.'": "",
|
||||
"'.Subscriber::IP.'": "0.0.0.0 - By API Request",
|
||||
"'.Subscriber::UNSUBSCRIPTION.'": "",
|
||||
"'.Subscriber::UNSUBSCRIPTION_IP.'": "0.0.0.0",
|
||||
"'.Subscriber::REFERRER.'": "",
|
||||
"'.Subscriber::SMS_PHONE.'": null,
|
||||
"'.Subscriber::SMS_STATUS.'": null,
|
||||
"'.Subscriber::SMS_BOUNCE.'": null,
|
||||
"'.Subscriber::SMS_DATE.'": "",
|
||||
"'.Subscriber::SMS_UNSUBSCRIPTION.'": "",
|
||||
"'.Subscriber::SMS_REFERRER.'": null,
|
||||
"'.Subscriber::FIELD_FIRSTNAME.'": "",
|
||||
"'.Subscriber::FIELD_LASTNAME.'": "",
|
||||
"'.Subscriber::FIELD_COMPANYNAME.'": "",
|
||||
"'.Subscriber::FIELD_STREET1.'": "",
|
||||
"'.Subscriber::FIELD_STREET2.'": "",
|
||||
"'.Subscriber::FIELD_CITY.'": "",
|
||||
"'.Subscriber::FIELD_STATE.'": "",
|
||||
"'.Subscriber::FIELD_ZIP.'": "",
|
||||
"'.Subscriber::FIELD_COUNTRY.'": "",
|
||||
"'.Subscriber::FIELD_PRIVATEPHONE.'": "",
|
||||
"'.Subscriber::FIELD_MOBILEPHONE.'": "",
|
||||
"'.Subscriber::FIELD_PHONE.'": "",
|
||||
"'.Subscriber::FIELD_FAX.'": "",
|
||||
"'.Subscriber::FIELD_WEBSITE.'": "",
|
||||
"'.Subscriber::FIELD_BIRTHDAY.'": "",
|
||||
"'.Subscriber::FIELD_LEADVALUE.'": ""
|
||||
}'), [
|
||||
"id" => "155988456",
|
||||
"listid" => "368370",
|
||||
"optin" => "28.12.2024 22:52:09",
|
||||
"optin_ip" => "0.0.0.0 - By API Request",
|
||||
"email" => "testsubscriber@mydomain.com",
|
||||
"status" => "Opt-In Pending",
|
||||
"bounce" => "Not Bounced",
|
||||
"date" => "",
|
||||
"ip" => "0.0.0.0 - By API Request",
|
||||
"unsubscription" => "",
|
||||
"unsubscription_ip" => "0.0.0.0",
|
||||
"referrer" => "",
|
||||
"sms_phone" => null,
|
||||
"sms_status" => null,
|
||||
"sms_bounce" => null,
|
||||
"sms_date" => "",
|
||||
"sms_unsubscription" => "",
|
||||
"sms_referrer" => null,
|
||||
"fieldFirstName" => "",
|
||||
"fieldLastName" => "",
|
||||
"fieldCompanyName" => "",
|
||||
"fieldStreet1" => "",
|
||||
"fieldStreet2" => "",
|
||||
"fieldCity" => "",
|
||||
"fieldState" => "",
|
||||
"fieldZip" => "",
|
||||
"fieldCountry" => "",
|
||||
"fieldPrivatePhone" => "",
|
||||
"fieldMobilePhone" => "",
|
||||
"fieldPhone" => "",
|
||||
"fieldFax" => "",
|
||||
"fieldWebsite" => "",
|
||||
"fieldBirthday" => "",
|
||||
"fieldLeadValue" => "",
|
||||
Subscriber::ID => "155988456",
|
||||
Subscriber::LISTID => "368370",
|
||||
Subscriber::OPTIN => "28.12.2024 22:52:09",
|
||||
Subscriber::OPTIN_IP => "0.0.0.0 - By API Request",
|
||||
Subscriber::EMAIL => "testsubscriber@mydomain.com",
|
||||
Subscriber::STATUS => "Opt-In Pending",
|
||||
Subscriber::BOUNCE => "Not Bounced",
|
||||
Subscriber::DATE => "",
|
||||
Subscriber::IP => "0.0.0.0 - By API Request",
|
||||
Subscriber::UNSUBSCRIPTION => "",
|
||||
Subscriber::UNSUBSCRIPTION_IP => "0.0.0.0",
|
||||
Subscriber::REFERRER => "",
|
||||
Subscriber::SMS_PHONE => null,
|
||||
Subscriber::SMS_STATUS => null,
|
||||
Subscriber::SMS_BOUNCE => null,
|
||||
Subscriber::SMS_DATE => "",
|
||||
Subscriber::SMS_UNSUBSCRIPTION => "",
|
||||
Subscriber::SMS_REFERRER => null,
|
||||
Subscriber::FIELD_FIRSTNAME => "",
|
||||
Subscriber::FIELD_LASTNAME => "",
|
||||
Subscriber::FIELD_COMPANYNAME => "",
|
||||
Subscriber::FIELD_STREET1 => "",
|
||||
Subscriber::FIELD_STREET2 => "",
|
||||
Subscriber::FIELD_CITY => "",
|
||||
Subscriber::FIELD_STATE => "",
|
||||
Subscriber::FIELD_ZIP => "",
|
||||
Subscriber::FIELD_COUNTRY => "",
|
||||
Subscriber::FIELD_PRIVATEPHONE => "",
|
||||
Subscriber::FIELD_MOBILEPHONE => "",
|
||||
Subscriber::FIELD_PHONE => "",
|
||||
Subscriber::FIELD_FAX => "",
|
||||
Subscriber::FIELD_WEBSITE => "",
|
||||
Subscriber::FIELD_BIRTHDAY => "",
|
||||
Subscriber::FIELD_LEADVALUE => "",
|
||||
]];
|
||||
yield 'unknown id' => [new Response(404, [], ''), null, true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
@ -255,40 +255,40 @@ class SubscriberTest extends IntegrationTestCase
|
||||
public static function subscribeDataProvider(): Generator
|
||||
{
|
||||
yield 'success' => [new Response(200, [], '{
|
||||
"id": "155988456",
|
||||
"listid": "368370",
|
||||
"optin": "28.12.2024 22:52:09",
|
||||
"optin_ip": "0.0.0.0 - By API Request",
|
||||
"email": "testsubscriber@mydomain.com",
|
||||
"status": "Opt-In Pending",
|
||||
"bounce": "Not Bounced",
|
||||
"date": "",
|
||||
"ip": "0.0.0.0 - By API Request",
|
||||
"unsubscription": "",
|
||||
"unsubscription_ip": "0.0.0.0",
|
||||
"referrer": "",
|
||||
"sms_phone": null,
|
||||
"sms_status": null,
|
||||
"sms_bounce": null,
|
||||
"sms_date": "",
|
||||
"sms_unsubscription": "",
|
||||
"sms_referrer": null,
|
||||
"fieldFirstName": "",
|
||||
"fieldLastName": "",
|
||||
"fieldCompanyName": "",
|
||||
"fieldStreet1": "",
|
||||
"fieldStreet2": "",
|
||||
"fieldCity": "",
|
||||
"fieldState": "",
|
||||
"fieldZip": "",
|
||||
"fieldCountry": "",
|
||||
"fieldPrivatePhone": "",
|
||||
"fieldMobilePhone": "",
|
||||
"fieldPhone": "",
|
||||
"fieldFax": "",
|
||||
"fieldWebsite": "",
|
||||
"fieldBirthday": "",
|
||||
"fieldLeadValue": ""
|
||||
"'.Subscriber::ID.'": "155988456",
|
||||
"'.Subscriber::LISTID.'": "368370",
|
||||
"'.Subscriber::OPTIN.'": "28.12.2024 22:52:09",
|
||||
"'.Subscriber::OPTIN_IP.'": "0.0.0.0 - By API Request",
|
||||
"'.Subscriber::EMAIL.'": "testsubscriber@mydomain.com",
|
||||
"'.Subscriber::STATUS.'": "Opt-In Pending",
|
||||
"'.Subscriber::BOUNCE.'": "Not Bounced",
|
||||
"'.Subscriber::DATE.'": "",
|
||||
"'.Subscriber::IP.'": "0.0.0.0 - By API Request",
|
||||
"'.Subscriber::UNSUBSCRIPTION.'": "",
|
||||
"'.Subscriber::UNSUBSCRIPTION_IP.'": "0.0.0.0",
|
||||
"'.Subscriber::REFERRER.'": "",
|
||||
"'.Subscriber::SMS_PHONE.'": null,
|
||||
"'.Subscriber::SMS_STATUS.'": null,
|
||||
"'.Subscriber::SMS_BOUNCE.'": null,
|
||||
"'.Subscriber::SMS_DATE.'": "",
|
||||
"'.Subscriber::SMS_UNSUBSCRIPTION.'": "",
|
||||
"'.Subscriber::SMS_REFERRER.'": null,
|
||||
"'.Subscriber::FIELD_FIRSTNAME.'": "",
|
||||
"'.Subscriber::FIELD_LASTNAME.'": "",
|
||||
"'.Subscriber::FIELD_COMPANYNAME.'": "",
|
||||
"'.Subscriber::FIELD_STREET1.'": "",
|
||||
"'.Subscriber::FIELD_STREET2.'": "",
|
||||
"'.Subscriber::FIELD_CITY.'": "",
|
||||
"'.Subscriber::FIELD_STATE.'": "",
|
||||
"'.Subscriber::FIELD_ZIP.'": "",
|
||||
"'.Subscriber::FIELD_COUNTRY.'": "",
|
||||
"'.Subscriber::FIELD_PRIVATEPHONE.'": "",
|
||||
"'.Subscriber::FIELD_MOBILEPHONE.'": "",
|
||||
"'.Subscriber::FIELD_PHONE.'": "",
|
||||
"'.Subscriber::FIELD_FAX.'": "",
|
||||
"'.Subscriber::FIELD_WEBSITE.'": "",
|
||||
"'.Subscriber::FIELD_BIRTHDAY.'": "",
|
||||
"'.Subscriber::FIELD_LEADVALUE.'": ""
|
||||
}'), '155988456'];
|
||||
yield 'missing mail' => [new Response(401, [], '{"error": 32}'), null, true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
@ -454,7 +454,7 @@ class SubscriberTest extends IntegrationTestCase
|
||||
$this->callMethod(
|
||||
$sut,
|
||||
'update',
|
||||
['2354758', ['fieldCity' => 'Berlin', 'fieldStreet2' => 'Straße unter den Linden 25'], 'mymail@mydomain.com']
|
||||
['2354758', [Subscriber::FIELD_CITY => 'Berlin', Subscriber::FIELD_STREET2 => 'Straße unter den Linden 25'], 'mymail@mydomain.com']
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -19,7 +19,6 @@ use D3\KlicktippPhpClient\Entities\Subscription;
|
||||
use D3\KlicktippPhpClient\Entities\SubscriptionList;
|
||||
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
||||
use D3\KlicktippPhpClient\Resources\SubscriptionProcess;
|
||||
use D3\KlicktippPhpClient\Resources\Tag;
|
||||
use D3\KlicktippPhpClient\tests\integration\IntegrationTestCase;
|
||||
use Generator;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
@ -114,6 +113,37 @@ class SubscriptionProcessTest extends IntegrationTestCase
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws ReflectionException
|
||||
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::update
|
||||
* @dataProvider updateDataProvider
|
||||
*/
|
||||
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false)
|
||||
{
|
||||
$sut = new SubscriptionProcess($this->getConnectionMock($response));
|
||||
|
||||
if ($expectException) {
|
||||
$this->expectException(BaseException::class);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$this->callMethod(
|
||||
$sut,
|
||||
'update',
|
||||
['470370', 'newName']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function updateDataProvider(): Generator
|
||||
{
|
||||
yield 'success' => [new Response(200, [], '[true]'), true];
|
||||
yield 'unknown id' => [new Response(404, [], '["Kein Opt-In-Prozess mit dieser ID."]'), null, true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws ReflectionException
|
||||
|
@ -93,13 +93,13 @@ class TagTest extends IntegrationTestCase
|
||||
public static function getDataProvider(): Generator
|
||||
{
|
||||
yield 'success' => [new Response(200, [], '{
|
||||
"tagid": "12514414",
|
||||
"name": "tagName2",
|
||||
"text": ""
|
||||
"'.Tag::ID.'": "12514414",
|
||||
"'.Tag::NAME.'": "tagName2",
|
||||
"'.Tag::TEXT.'": ""
|
||||
}'), [
|
||||
"tagid" => "12514414",
|
||||
"name" => "tagName2",
|
||||
"text" => "",
|
||||
Tag::ID => "12514414",
|
||||
Tag::NAME => "tagName2",
|
||||
Tag::TEXT => "",
|
||||
]];
|
||||
yield 'unknown id' => [new Response(404, [], '["Kein Tag mit dieser ID."]'), null, true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
|
@ -16,6 +16,7 @@
|
||||
namespace D3\KlicktippPhpClient\tests\unit\Entities;
|
||||
|
||||
use D3\KlicktippPhpClient\Entities\Subscriber;
|
||||
use D3\KlicktippPhpClient\Resources\Subscriber as SubscriberEndpoint;
|
||||
use D3\KlicktippPhpClient\tests\TestCase;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@ -33,81 +34,81 @@ class SubscriberTest extends TestCase
|
||||
parent::setUp();
|
||||
$this->entity = new Subscriber(
|
||||
[
|
||||
"id" => "155988456",
|
||||
"listid" => "368370",
|
||||
"optin" => "28.12.2024 22:52:09",
|
||||
"optin_ip" => "0.0.0.0 - By API Request",
|
||||
"email" => "testsubscriber@mydomain.com",
|
||||
"status" => "Opt-In Pending",
|
||||
"bounce" => "Not Bounced",
|
||||
"date" => "2024-12-24",
|
||||
"ip" => "0.0.0.0 - By API Request",
|
||||
"unsubscription" => "unsubscription fixture",
|
||||
"unsubscription_ip" => "0.0.0.0",
|
||||
"referrer" => "referrer fixture",
|
||||
"sms_phone" => "1234567890",
|
||||
"sms_status" => "sms status fixture",
|
||||
"sms_bounce" => "sms bounce fixture",
|
||||
"sms_date" => "2024-12-23",
|
||||
"sms_unsubscription" => "sms unsubscription fixture",
|
||||
"sms_referrer" => "sms referrer fixture",
|
||||
"fieldFirstName" => "",
|
||||
"fieldLastName" => "",
|
||||
"fieldCompanyName" => "",
|
||||
"fieldStreet1" => "",
|
||||
"fieldStreet2" => "",
|
||||
"fieldCity" => "",
|
||||
"fieldState" => "",
|
||||
"fieldZip" => "",
|
||||
"fieldCountry" => "",
|
||||
"fieldPrivatePhone" => "",
|
||||
"fieldMobilePhone" => "",
|
||||
"fieldPhone" => "",
|
||||
"fieldFax" => "",
|
||||
"fieldWebsite" => "",
|
||||
"fieldBirthday" => "",
|
||||
"fieldLeadValue" => "",
|
||||
"tags" => [
|
||||
SubscriberEndpoint::ID => "155988456",
|
||||
SubscriberEndpoint::LISTID => "368370",
|
||||
SubscriberEndpoint::OPTIN => "28.12.2024 22:52:09",
|
||||
SubscriberEndpoint::OPTIN_IP => "0.0.0.0 - By API Request",
|
||||
SubscriberEndpoint::EMAIL => "testsubscriber@mydomain.com",
|
||||
SubscriberEndpoint::STATUS => "Opt-In Pending",
|
||||
SubscriberEndpoint::BOUNCE => "Not Bounced",
|
||||
SubscriberEndpoint::DATE => "2024-12-24",
|
||||
SubscriberEndpoint::IP => "0.0.0.0 - By API Request",
|
||||
SubscriberEndpoint::UNSUBSCRIPTION => "unsubscription fixture",
|
||||
SubscriberEndpoint::UNSUBSCRIPTION_IP => "0.0.0.0",
|
||||
SubscriberEndpoint::REFERRER => "referrer fixture",
|
||||
SubscriberEndpoint::SMS_PHONE => "1234567890",
|
||||
SubscriberEndpoint::SMS_STATUS => "sms status fixture",
|
||||
SubscriberEndpoint::SMS_BOUNCE => "sms bounce fixture",
|
||||
SubscriberEndpoint::SMS_DATE => "2024-12-23",
|
||||
SubscriberEndpoint::SMS_UNSUBSCRIPTION => "sms unsubscription fixture",
|
||||
SubscriberEndpoint::SMS_REFERRER => "sms referrer fixture",
|
||||
SubscriberEndpoint::FIELD_FIRSTNAME => "",
|
||||
SubscriberEndpoint::FIELD_LASTNAME => "",
|
||||
SubscriberEndpoint::FIELD_COMPANYNAME => "",
|
||||
SubscriberEndpoint::FIELD_STREET1 => "",
|
||||
SubscriberEndpoint::FIELD_STREET2 => "",
|
||||
SubscriberEndpoint::FIELD_CITY => "",
|
||||
SubscriberEndpoint::FIELD_STATE => "",
|
||||
SubscriberEndpoint::FIELD_ZIP => "",
|
||||
SubscriberEndpoint::FIELD_COUNTRY => "",
|
||||
SubscriberEndpoint::FIELD_PRIVATEPHONE => "",
|
||||
SubscriberEndpoint::FIELD_MOBILEPHONE => "",
|
||||
SubscriberEndpoint::FIELD_PHONE => "",
|
||||
SubscriberEndpoint::FIELD_FAX => "",
|
||||
SubscriberEndpoint::FIELD_WEBSITE => "",
|
||||
SubscriberEndpoint::FIELD_BIRTHDAY => "",
|
||||
SubscriberEndpoint::FIELD_LEADVALUE => "",
|
||||
SubscriberEndpoint::TAGS => [
|
||||
"12494453",
|
||||
"12494463",
|
||||
],
|
||||
"manual_tags" => [
|
||||
SubscriberEndpoint::MANUALTAGS => [
|
||||
"12594453" => "125959453",
|
||||
"12594454" => "125960453",
|
||||
"12594455" => "125961453",
|
||||
],
|
||||
"smart_tags" => [
|
||||
SubscriberEndpoint::SMARTTAGS => [
|
||||
"12594456" => "125959453",
|
||||
"12594457" => "125960453",
|
||||
"12594458" => "125961453",
|
||||
"12594459" => "125961453",
|
||||
],
|
||||
"campaigns_started" => [
|
||||
SubscriberEndpoint::CAMPAIGNSSTARTED => [
|
||||
"12594456" => "125959453",
|
||||
],
|
||||
"campaigns_finished" => [
|
||||
SubscriberEndpoint::CAMPAIGNSFINISHED => [
|
||||
"12594456" => "125959453",
|
||||
"12594457" => "125959453",
|
||||
],
|
||||
"notification_emails_sent" => [
|
||||
SubscriberEndpoint::NOTIFICATIONEMAILSSENT => [
|
||||
"1570256" => "1730508478",
|
||||
"1570257" => "1730508479",
|
||||
"1570258" => "1730508480",
|
||||
],
|
||||
"notification_emails_opened" => [
|
||||
SubscriberEndpoint::NOTIFICATIONEMAILSOPENED => [
|
||||
"1570256" => "1730508478",
|
||||
"1570257" => "1730508479",
|
||||
"1570258" => "1730508480",
|
||||
"1570259" => "1730508481",
|
||||
],
|
||||
"notification_emails_clicked" => [
|
||||
SubscriberEndpoint::NOTIFICATIONEMAILSCLICKED => [
|
||||
"1570256" => "1730508478",
|
||||
"1570257" => "1730508479",
|
||||
"1570258" => "1730508480",
|
||||
"1570259" => "1730508481",
|
||||
"1570260" => "1730508482",
|
||||
],
|
||||
"notification_emails_viewed" => [
|
||||
SubscriberEndpoint::NOTIFICATIONEMAILSVIEWED => [
|
||||
"1570256" => "1730508478",
|
||||
"1570257" => "1730508479",
|
||||
"1570258" => "1730508480",
|
||||
@ -115,7 +116,7 @@ class SubscriberTest extends TestCase
|
||||
"1570260" => "1730508482",
|
||||
"1570261" => "1730508483",
|
||||
],
|
||||
"outbound" => [
|
||||
SubscriberEndpoint::OUTBOUND => [
|
||||
"1570256" => "1730508478",
|
||||
],
|
||||
]
|
||||
@ -134,7 +135,7 @@ class SubscriberTest extends TestCase
|
||||
'key2' => 'value2',
|
||||
];
|
||||
|
||||
$endpoint = $this->getMockBuilder(\D3\KlicktippPhpClient\Resources\Subscriber::class)
|
||||
$endpoint = $this->getMockBuilder(SubscriberEndpoint::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -342,7 +343,7 @@ class SubscriberTest extends TestCase
|
||||
): void {
|
||||
$sut = $this->getMockBuilder(Subscriber::class)
|
||||
->onlyMethods(['set'])
|
||||
->setConstructorArgs([['id' => 'foo']])
|
||||
->setConstructorArgs([[SubscriberEndpoint::ID => 'foo']])
|
||||
->getMock();
|
||||
$sut->expects($this->once())->method('set')->with(
|
||||
$this->identicalTo($fieldName)
|
||||
@ -413,8 +414,8 @@ class SubscriberTest extends TestCase
|
||||
|
||||
public static function getFieldDataProvider(): Generator
|
||||
{
|
||||
yield 'short field name' => ['FirstName', 'fieldFirstName'];
|
||||
yield 'long field name' => ['fieldLastName', 'fieldLastName'];
|
||||
yield 'short field name' => ['FirstName', SubscriberEndpoint::FIELD_FIRSTNAME];
|
||||
yield 'long field name' => ['fieldLastName', SubscriberEndpoint::FIELD_LASTNAME];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -429,7 +430,7 @@ class SubscriberTest extends TestCase
|
||||
): void {
|
||||
$sut = $this->getMockBuilder(Subscriber::class)
|
||||
->onlyMethods(['set'])
|
||||
->setConstructorArgs([['id' => 'foo']])
|
||||
->setConstructorArgs([[SubscriberEndpoint::ID => 'foo']])
|
||||
->getMock();
|
||||
$sut->expects($this->once())->method('set')->with(
|
||||
$this->identicalTo($longFieldName)
|
||||
@ -444,8 +445,8 @@ class SubscriberTest extends TestCase
|
||||
|
||||
public static function setFieldDataProvider(): Generator
|
||||
{
|
||||
yield 'short field name' => ['FirstName', 'fieldFirstName'];
|
||||
yield 'long field name' => ['fieldLastName', 'fieldLastName'];
|
||||
yield 'short field name' => ['FirstName', SubscriberEndpoint::FIELD_FIRSTNAME];
|
||||
yield 'long field name' => ['fieldLastName', SubscriberEndpoint::FIELD_LASTNAME];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -587,14 +588,14 @@ class SubscriberTest extends TestCase
|
||||
InvokedCount $endpointInvocation,
|
||||
?bool $expectedReturn
|
||||
): void {
|
||||
$endpointMock = $this->getMockBuilder(\D3\KlicktippPhpClient\Resources\Subscriber::class)
|
||||
$endpointMock = $this->getMockBuilder(SubscriberEndpoint::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods(['update'])
|
||||
->getMock();
|
||||
$endpointMock->expects($endpointInvocation)->method('update')->willReturn(true);
|
||||
|
||||
$sut = $this->getMockBuilder(Subscriber::class)
|
||||
->setConstructorArgs([['id' => 'foo'], $endpointSet ? $endpointMock : null])
|
||||
->setConstructorArgs([[SubscriberEndpoint::ID => 'foo'], $endpointSet ? $endpointMock : null])
|
||||
->onlyMethods(['persistTags'])
|
||||
->getMock();
|
||||
$sut->expects($this->once())->method('persistTags');
|
||||
@ -636,7 +637,7 @@ class SubscriberTest extends TestCase
|
||||
"12494463",
|
||||
]));
|
||||
|
||||
$endpointMock = $this->getMockBuilder(\D3\KlicktippPhpClient\Resources\Subscriber::class)
|
||||
$endpointMock = $this->getMockBuilder(SubscriberEndpoint::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods(['get', 'tag', 'untag'])
|
||||
->getMock();
|
||||
@ -644,7 +645,7 @@ class SubscriberTest extends TestCase
|
||||
$endpointMock->expects($setTagInvocation)->method('tag')->willReturn(true);
|
||||
$endpointMock->expects($removeTagInvocation)->method('untag')->willReturn(true);
|
||||
|
||||
$sut = new Subscriber(['id' => 'foo', 'email' => 'mymail@mydomain.tld'], $endpointSet ? $endpointMock : null);
|
||||
$sut = new Subscriber([SubscriberEndpoint::ID => 'foo', SubscriberEndpoint::EMAIL => 'mymail@mydomain.tld'], $endpointSet ? $endpointMock : null);
|
||||
if ($newTagList) {
|
||||
$sut->set('tags', $newTagList);
|
||||
}
|
||||
|
Chargement…
x
Référencer dans un nouveau ticket
Bloquer un utilisateur