public function testGetDownloadFile()
 {
     $response = $this->getXMLFileMock('getDownloadFileResponse.xml');
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('getDownloadFile', ['id' => '1234'])->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new MemberExportService($this->clientFactory);
     $this->assertEquals($response, $service->getDownloadFile('1234'));
 }
 public function testGetLinkReport()
 {
     $response = (array) $this->getXMLFileMock('getLinkReportResponse.xml');
     $campaignId = '1';
     $page = 'test';
     $parameters = ['campaignId' => (string) $campaignId, 'page' => (int) $page];
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('getLinkReport', $parameters)->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new ReportingService($this->clientFactory);
     $this->assertEquals($response, $service->getLinkReport($campaignId, $page));
 }
 public function testSendObject()
 {
     $response = $this->getXMLFileMock('sendObjectResponse.xml');
     $uniqueIdentifier = 'uniqueId';
     $securityTag = 'securityTag';
     $email = '*****@*****.**';
     $type = 'INSERT_UPDATE';
     $sendDate = time();
     $uidKey = 'email';
     $parameters['sendrequest'] = ['email' => $email, 'encrypt' => $securityTag, 'random' => $uniqueIdentifier, 'senddate' => $sendDate, 'synchrotype' => $type, 'uidkey' => $uidKey];
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('sendObject', $parameters)->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new NotificationService($this->clientFactory);
     $this->assertEquals($response, $service->sendObject($uniqueIdentifier, $securityTag, $email, null, null, $type, $sendDate, $uidKey));
 }
 public function testUploadFileMerge()
 {
     $response = $this->getXMLFileMock('uploadFileMergeResponse.xml');
     $fileContent = 'EMAIL|EXTRATEST username@mail.com|0';
     $filename = 'file.csv';
     $criteria = 'LOWER(EMAIL)';
     $mapping = '<mapping>' . '<column>' . '<colNum>1</colNum>' . '<fieldName>EMAIL</fieldName>' . '</column>' . '<column>' . '<colNum>2</colNum>' . '<fieldName>EXTRATEST</fieldName>' . '<toReplace>true</toReplace>' . '</column>' . '</mapping>';
     $fileEncoding = 'UTF-8';
     $separator = '|';
     $skipFirsLine = false;
     $dateFormat = 'mm/dd/yyyy';
     $parameters['mergeUpload'] = ['fileName' => $filename, 'fileEncoding' => $fileEncoding, 'separator' => $separator, 'skipFirstLine' => $skipFirsLine, 'dateFormat' => $dateFormat, 'criteria' => $criteria, 'mapping' => $mapping, 'file' => $fileContent];
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('uploadFileMerge', $parameters)->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new BatchMemberService($this->clientFactory);
     $this->assertEquals($response, $service->uploadFileMerge($fileContent, $filename, $criteria, $mapping, $fileEncoding, $separator, $skipFirsLine, $dateFormat));
 }
 public function testGetNotValidatedSenders()
 {
     $response = (array) $this->getXMLFileMock('getNotValidatedSendersResponse.xml');
     $parameters = array();
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('getNotValidatedSenders', $parameters)->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new CcmdMessageService($this->clientFactory);
     $this->assertEquals($response, $service->getNotValidatedSenders());
 }
 public function testGetAllBannerTrackableLinks()
 {
     $response = (array) $this->getXMLFileMock('getAllBannerTrackableLinksResponse.xml');
     $id = '1';
     $parameters = ['id' => (string) $id];
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('getAllBannerTrackableLinks', $parameters)->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new CcmdDynamicContentService($this->clientFactory);
     $this->assertEquals($response, $service->getAllBannerTrackableLinks($id));
 }
 public function testGetUrlByOrder()
 {
     $response = (array) $this->getXMLFileMock('getUrlByOrderResponse.xml');
     $messageId = '1';
     $order = 'test';
     $parameters = ['messageId' => (string) $messageId, 'order' => (int) $order];
     $apiClient = $this->getMockBuilder('\\MyLittle\\CampaignCommander\\API\\SOAP\\APIClient')->disableOriginalConstructor()->getMock();
     $apiClient->expects($this->once())->method('doCall')->with('getUrlByOrder', $parameters)->will($this->returnValue($response));
     $this->clientFactory->expects($this->any())->method('createClient')->will($this->returnValue($apiClient));
     $service = new CcmdURLService($this->clientFactory);
     $this->assertEquals($response, $service->getUrlByOrder($messageId, $order));
 }