public function testSettingBody() { $expected = "Foo"; $msg = new BlackberryMessage(); $msg->setMessage("Foo"); $this->assertEquals($expected, $msg->getMessageBody()); }
/** * Create the XML body that accompanies the actual push data * * @param $messageID * @return string */ private function getXMLBody(BlackberryMessage $message, $messageID) { $deliverBefore = gmdate('Y-m-d\\TH:i:s\\Z', strtotime('+5 minutes')); $impl = new \DOMImplementation(); $dtd = $impl->createDocumentType("pap", "-//WAPFORUM//DTD PAP 2.1//EN", "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd"); $doc = $impl->createDocument("", "", $dtd); // Build it centre-out $pm = $doc->createElement("push-message"); $pm->setAttribute("push-id", $messageID); $pm->setAttribute("deliver-before-timestamp", $deliverBefore); $pm->setAttribute("source-reference", $this->appID); $qos = $doc->createElement("quality-of-service"); $qos->setAttribute("delivery-method", "unconfirmed"); $add = $doc->createElement("address"); $add->setAttribute("address-value", $message->getDeviceIdentifier()); $pm->appendChild($add); $pm->appendChild($qos); $pap = $doc->createElement("pap"); $pap->appendChild($pm); $doc->appendChild($pap); return $doc->saveXML(); }