Exemplo n.º 1
0
 public function testActionHeader()
 {
     $this->eml = new InlineEmail('template');
     $template = $this->docs('testEmailTemplate');
     $this->eml->template = $template->id;
     $this->eml->modelId = $this->contacts('testAnyone')->id;
     $this->eml->modelName = 'Contacts';
     $this->eml->subject = 'Test Email Subject';
     $this->eml->from = array('name' => 'Sales Rep', 'address' => '*****@*****.**');
     $this->eml->to = '"Testfirstname Testlastname" <*****@*****.**>';
     $this->eml->prepareBody();
     $record = $this->eml->insertInBody($this->eml->actionHeader, 1, 1);
     $this->assertTrue((bool) preg_match('/<body>(.*)<\\/body>/um', $record, $matches), "Body isn't an HTML document. What's going on here? Body = " . $record);
     $content = $matches[1];
     //		$contentLines = explode('<br />', $content);
     //		$subjectLine = $contentLines[0];
     //		$fromLine = $contentLines[1];
     //		$toLine = $contentLines[2];
     $this->assertRegExp('/(<strong>Subject: <\\/strong>.*)<br \\/>/u', $content);
     $this->assertRegExp('/(<strong>From: <\\/strong>.*)<br \\/>/u', $content);
     $this->assertRegExp('/(<strong>To: <\\/strong>.*)<br \\/>/u', $content);
 }