Beispiel #1
0
 public function testInitialization()
 {
     $Message1 = new Message('hello');
     $this->assertEquals('UTF-8', $Message1->getCharset());
     $this->assertEmpty($Message1->getTransactionId());
     $this->assertEmpty($Message1->getPhones());
     $this->assertNull($Message1->getPrefix());
     $this->assertEquals('hello', $Message1->getText());
     $this->assertNull($Message1->getUserDataHeader());
     $Message2 = new Message('');
     $Message2->setPhones([79031234567]);
     $this->assertEquals([79031234567], $Message2->getPhones());
     $Message2->addPhone(79165557755);
     $this->assertEquals([79031234567, 79165557755], $Message2->getPhones());
     $Message2->setPhones([]);
     $this->assertEmpty($Message2->getPhones());
     $Message3 = new Message('');
     $Message3->setCharset('UTF-16BE');
     $this->assertEquals('UTF-16BE', $Message3->getCharset());
     $Message3->setCharset('UTF-8');
     $this->assertEquals('UTF-8', $Message3->getCharset());
     $Message4 = new Message('');
     $Message4->setPrefix('OPOP');
     $this->assertEquals('OPOP', $Message4->getPrefix());
     $Message5 = new Message('');
     $Message5->setTransactionId('s0meTr4n54CTi0N');
     $this->assertEquals('s0meTr4n54CTi0N', $Message5->getTransactionId());
     $Message6 = new Message('');
     $Message6->setUserDataHeader('AABB667788DD');
     $this->assertEquals('AABB667788DD', $Message6->getUserDataHeader());
 }
Beispiel #2
0
 /**
  * Sign message method
  * @param Message $Message message instance
  * @return string message signature
  */
 private function sign(Message $Message)
 {
     return md5($this->user . $this->from . implode($Message->getPhones()) . $Message->getText() . $this->secret);
 }