示例#1
0
 /**
  * @test
  */
 public function it_adds_notifications()
 {
     $message = $this->prophesize(DTO\Message::class);
     $this->mockedRecordDecoder->addEntries(Argument::type(Camt054\DTO\Notification::class), Argument::type('\\SimpleXMLElement'))->shouldBeCalled();
     $message->setRecords(Argument::that(function ($argument) {
         return is_array($argument) && $argument[0] instanceof Camt054\DTO\Notification;
     }))->shouldBeCalled();
     $this->decoder->addRecords($message->reveal(), $this->getXmlMessage());
 }
示例#2
0
文件: Decoder.php 项目: genkgo/camt
 /**
  * @param DOMDocument $document
  * @return Message
  * @throws InvalidMessageException
  */
 public function decode(DOMDocument $document)
 {
     $this->validate($document);
     $this->document = simplexml_import_dom($document);
     $message = new DTO\Message();
     $this->messageDecoder->addGroupHeader($message, $this->document);
     $this->messageDecoder->addRecords($message, $this->document);
     return $message;
 }