function __construct(Campaign $campaign)
 {
     $this->Name = $campaign->getName();
     $this->Subject = $campaign->getSubject();
     $this->WebLocation = $campaign->getWebLocation();
     $this->ConfirmationToEmail = $campaign->getConfirmationTo();
     if (!is_null($campaign->getSender())) {
         $this->SenderEmail = $campaign->getSender()->getEmail();
     } else {
         $this->SenderEmail = null;
     }
     if (!is_null($campaign->getReplyToEmail())) {
         $this->ReplyToEmail = $campaign->getReplyToEmail()->getEmail();
     } else {
         $this->ReplyToEmail = null;
     }
     if (!is_null($campaign->getMailingList())) {
         $this->MailingListID = $campaign->getMailingList()->getID();
     } else {
         $this->MailingListID = null;
     }
     if (!is_null($campaign->getSegment())) {
         $this->SegmentID = $campaign->getSegment()->getID();
     } else {
         $this->SegmentID = 0;
     }
     if (!is_null($campaign->getABCampaignData())) {
         $this->ABCampaignType = $campaign->getABCampaignData()->getABCampaignType();
         $this->ABWinnerSelectionType = $campaign->getABCampaignData()->getABWinnerSelectionType();
         $this->HoursToTest = $campaign->getABCampaignData()->getHoursToTest();
         $this->ListPercentage = $campaign->getABCampaignData()->getListPercentage();
         $this->SubjectB = $campaign->getABCampaignData()->getSubjectB();
         $this->WebLocationB = $campaign->getABCampaignData()->getWebLocationB();
         if (!is_null($campaign->getABCampaignData()->getSenderB())) {
             $this->SenderEmailB = $campaign->getABCampaignData()->getSenderB()->getEmail();
         } else {
             $this->SenderEmailB = null;
         }
     }
 }
 /**
  * Test UpdateDraftRequest constructor when Sender, ReplyToEmail, MailingList, Segment, getABCampaignData are null.
  * @group UpdateDraftRequestTest
  * @covers moosend\Actions\UpdateDraft\UpdateDraftRequest::__construct
  */
 public function test_Can_Create_UpdateDraftRequest_Instance_When_Properties_Are_Null()
 {
     $campaign = new Campaign();
     $ABCampaignData = new ABCampaignData();
     $campaign->setABCampaignData($ABCampaignData);
     $updateDraftRequest = new UpdateDraftRequest($campaign);
     $this->assertInstanceOf('moosend\\Actions\\UpdateDraft\\UpdateDraftRequest', $updateDraftRequest);
     $this->assertEquals($campaign->getName(), $updateDraftRequest->Name);
     $this->assertEquals($campaign->getSubject(), $updateDraftRequest->Subject);
     $this->assertEquals($campaign->getWebLocation(), $updateDraftRequest->WebLocation);
     $this->assertEquals($campaign->getConfirmationTo(), $updateDraftRequest->ConfirmationToEmail);
     $this->assertEquals(null, $updateDraftRequest->SenderEmail);
     $this->assertEquals(null, $updateDraftRequest->ReplyToEmail);
     $this->assertEquals(null, $updateDraftRequest->MailingListID);
     $this->assertEquals(null, $updateDraftRequest->SegmentID);
     $this->assertEquals(null, $updateDraftRequest->ABCampaignType);
     $this->assertEquals(null, $updateDraftRequest->ABWinnerSelectionType);
     $this->assertEquals(null, $updateDraftRequest->HoursToTest);
     $this->assertEquals(null, $updateDraftRequest->ListPercentage);
     $this->assertEquals(null, $updateDraftRequest->SubjectB);
     $this->assertEquals(null, $updateDraftRequest->WebLocationB);
     $this->assertEquals(null, $updateDraftRequest->SenderEmailB);
 }