public function testValid() { /** @var Element $campaign */ $campaign = new Campaign(); $campaign->setName('Campagne Test'); $campaign->setTrackId('1234'); $campaign->setApplication('Copromatic'); $campaign->setBreakdownCode('COPRO-1-2015'); $campaign->setUser($this->getValidUser()); $campaign->addRequest($this->getValidRequest()); $campaign->addRequest($this->getValidRequest()); $campaign->verify(); }
public static function getDomFromCampaign(Campaign $campaign) { $domDoc = new \DOMDocument(); $element = $domDoc->createElementNS(\Maileva\Element::NAMESPACE_PJS, 'pjs:Campaign'); $element->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:com', \Maileva\Element::NAMESPACE_COM); $element->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:spec', \Maileva\Element::NAMESPACE_SPEC); $element->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', \Maileva\Element::NAMESPACE_XSI); $domDoc->appendChild($element); //Verification de la syntax du xml $campaign->verify(); //generation du XML $campaign->generateXml($element); return $domDoc; }