From c96a1b9477d724f63bedb13bf474cf3563bdb3b6 Mon Sep 17 00:00:00 2001 From: Thomas GASC Date: Wed, 7 Dec 2016 10:49:12 +0100 Subject: [PATCH] fix START_DT format in sent XML Campaign --- src/Request/CreateCampaign.php | 4 +++- tests/Broadcast/CampaignTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Request/CreateCampaign.php b/src/Request/CreateCampaign.php index 99a42d1..04c6e1e 100644 --- a/src/Request/CreateCampaign.php +++ b/src/Request/CreateCampaign.php @@ -20,6 +20,8 @@ */ class CreateCampaign { + const DATETIME_FORMAT = 'YmdHmi'; + /** * @var \XMLWriter $writer */ @@ -92,7 +94,7 @@ private function campaign(Campaign $campaign) 'NAME' => $campaign->getName(), 'STATE' => $campaign->getState(), 'FOLDERID' => $campaign->getFolderId(), - 'START_DT' => $campaign->getStartDate()->format('Ymdhmi'), + 'START_DT' => $campaign->getStartDate()->format(self::DATETIME_FORMAT), 'DESCRIPTION' => $campaign->getDescription(), 'MACATEGORY' => $campaign->getMaCategory(), 'PRODUCTID' => $campaign->getProductId(), diff --git a/tests/Broadcast/CampaignTest.php b/tests/Broadcast/CampaignTest.php index 70e792a..739c6d1 100644 --- a/tests/Broadcast/CampaignTest.php +++ b/tests/Broadcast/CampaignTest.php @@ -46,7 +46,7 @@ public function testXml() $this->assertEquals($campaign->getName(), (string) $document->CAMPAIGN['NAME']); $this->assertEquals($campaign->getFolderId(), (int) $document->CAMPAIGN['FOLDERID']); $this->assertEquals($campaign->getState(), (string) $document->CAMPAIGN['STATE']); - $this->assertEquals($campaign->getStartDate()->format('Ymdhmi'), (string) $document->CAMPAIGN['START_DT']); + $this->assertEquals($campaign->getStartDate()->format(CreateCampaign::DATETIME_FORMAT), (string) $document->CAMPAIGN['START_DT']); $this->assertEquals($campaign->getDescription(), (string) $document->CAMPAIGN['DESCRIPTION']); $this->assertEquals($campaign->getMaCategory(), (string) $document->CAMPAIGN['MACATEGORY']); $this->assertEquals($campaign->getProductId(), (int) $document->CAMPAIGN['PRODUCTID']);