/**
  * @test
  */
 public function doesNotMergeIfNotTemplate()
 {
     $daoStub = $this->getMockBuilder('phpList\\plugin\\ContentAreas\\DAO')->disableOriginalConstructor()->getMock();
     $daoStub->method('messageData')->willReturn('SER:' . serialize(['article' => '<p>here is the article</p>']));
     $template = '<html><body><div></div></body></html>';
     $this->assertEquals(false, TemplateModel::mergeIfTemplate($template, 123, $daoStub));
 }
 /**
  * Called by ViewBrowser plugin to manipulate template and message.
  * Sets the message content to the merged template and message areas.
  * 
  * @param string &$templateBody the body of the template
  * @param array  &$messageData  the message data
  */
 public function viewBrowserHook(&$templateBody, array &$messageData)
 {
     if ($merged = TemplateModel::mergeIfTemplate($templateBody, $messageData['id'])) {
         $messageData['message'] = str_ireplace('[CONTENT]', $messageData['message'], $merged);
         $messageData['template'] = 0;
         $messageData['htmlformatted'] = true;
         $templateBody = '';
     }
 }