/**
  * Test if SenderDetailsAction returns Sender object when onParse is called.
  * @group SenderDetailsActionTest
  * @covers moosend\Actions\SenderDetails\SenderDetailsAction::onParse
  */
 public function test_Should_Return_Sender_Object_When_SenderDetailsAction_Calls_onParse_With_Success()
 {
     $jsonData = json_decode(file_get_contents(__DIR__ . '/../../JsonResponses/getSenderDetailsJsonResponse.html'), true)['Context'];
     $returnedObject = $this->_action->onParse($jsonData);
     $expectedObject = Sender::withJSON($jsonData);
     $this->assertEquals($expectedObject, $returnedObject);
 }
Exemplo n.º 2
0
 public function __construct(array $jsonData)
 {
     foreach ($jsonData as $sender) {
         $entry = Sender::withJSON($sender);
         $this->append($entry);
     }
 }
Exemplo n.º 3
0
 /**
  * Test custom "constructor" when providing valid JSON data.
  * @covers moosend\Models\ABCampaignData::withJSON
  * @group ABCampaignDataTest
  */
 public function test_Can_Create_ABCampaignData_Instance_When_Providing_Valid_Json_Data_To_Custom_Constructor()
 {
     $this->assertEquals(128, $this->_ABCampaignData->getID());
     $this->assertEquals('Alternate Subject', $this->_ABCampaignData->getSubjectB());
     $this->assertEquals(null, $this->_ABCampaignData->getPlainContentB());
     $this->assertEquals(null, $this->_ABCampaignData->getHTMLContentB());
     $this->assertEquals(null, $this->_ABCampaignData->getWebLocationB());
     $this->assertEquals(Sender::withJSON($this->_jsonData['SenderB']), $this->_ABCampaignData->getSenderB());
     $this->assertEquals(1, $this->_ABCampaignData->getHoursToTest());
     $this->assertEquals(25, $this->_ABCampaignData->getListPercentage());
     $this->assertEquals(2, $this->_ABCampaignData->getABCampaignType());
     $this->assertEquals(0, $this->_ABCampaignData->getABWinnerSelectionType());
     $this->assertEquals(null, $this->_ABCampaignData->getDeliveredOnA());
     $this->assertEquals(null, $this->_ABCampaignData->getDeliveredOnB());
 }
Exemplo n.º 4
0
 /**
  * Test custom "constructor" when providing valid JSON data.
  * @covers moosend\Models\Campaign::withJSON
  * @group CampaignTest
  */
 public function test_Can_Create_Campaign_Instance_When_Providing_Valid_Json_Data_To_Custom_Constructor()
 {
     $this->assertEquals('4824c0fb-c41c-4b09-a35d-03d4e6177630', $this->_campaign->getID());
     $this->assertEquals('Your Campaign Name', $this->_campaign->getName());
     $this->assertEquals('Your Campaign Subject', $this->_campaign->getSubject());
     $this->assertEquals('http://www.your-domain.com/newsletter', $this->_campaign->getWebLocation());
     $this->assertEquals('SOME HTML BODY', $this->_campaign->getHTMLContent());
     $this->assertEquals('Some plain text body', $this->_campaign->getPlainContent());
     $this->assertEquals(Sender::withJSON($this->_jsonData['Sender']), $this->_campaign->getSender());
     $this->assertEquals(null, $this->_campaign->getDeliveredOn());
     $this->assertEquals(Sender::withJSON($this->_jsonData['ReplyToEmail']), $this->_campaign->getReplyToEmail());
     $this->assertEquals('/Date(1368710321000+0300)/', $this->_campaign->getCreatedOn());
     $this->assertEquals('/Date(1368839678000+0300)/', $this->_campaign->getUpdatedOn());
     $this->assertEquals('/Date(1369017000000+0300)/', $this->_campaign->getScheduledFor());
     $this->assertEquals('GTB Standard Time', $this->_campaign->getTimezone());
     $this->assertEquals(0, $this->_campaign->getFormatType());
     $this->assertEquals(ABCampaignData::withJSON($this->_jsonData['ABCampaignData']), $this->_campaign->getABCampaignData());
     $this->assertEquals(MailingList::withJSON($this->_jsonData['MailingList']), $this->_campaign->getMailingList());
     $this->assertEquals('*****@*****.**', $this->_campaign->getConfirmationTo());
     $this->assertEquals(0, $this->_campaign->getStatus());
     $this->assertEquals(Segment::withJSON($this->_jsonData['Segment']), $this->_campaign->getSegment());
     $this->assertEquals(false, $this->_campaign->getIsTransactional());
     $this->assertInstanceOf('moosend\\Models\\Campaign', $this->_campaign);
 }
Exemplo n.º 5
0
 public function setUp()
 {
     $this->_jsonData = json_decode(file_get_contents(__DIR__ . '/../../tests/JsonResponses/getSenderDetailsJsonResponse.html'), true)['Context'];
     $this->_sender = Sender::withJSON($this->_jsonData);
 }
Exemplo n.º 6
0
 public function onParse($jsonData)
 {
     return Sender::withJSON($jsonData);
 }