Skip to content

Commit

Permalink
Bugfix: set Message::merge to true if either merge var or global merg…
Browse files Browse the repository at this point in the history
…e var was set
  • Loading branch information
Sven Loth committed Jan 26, 2015
1 parent 2f06daa commit d5d7b8c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ public function addGlobalMergeVar($name, $content)
'name' => $name,
'content' => $content,
);

$this->setMerge(true);

return $this;
}
Expand All @@ -319,6 +321,8 @@ public function addMergeVar($recipient, $name, $content)
)
);

$this->setMerge(true);

return $this;
}

Expand Down
17 changes: 17 additions & 0 deletions Tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,21 @@ public function testIsImportant()
$this->assertEquals('High', $headers['Importance']);
$this->assertEquals('urgent', $headers['Priority']);
}

public function testSetMergeVar()
{
$message = new Message();
$this->assertEquals(false, $message->getMerge());
$message->addMergeVar('[email protected]', 'testkey', 'testvalue');
$this->assertEquals(true, $message->getMerge());
}

public function testSetGlobalMergeVar()
{
$message = new Message();
$this->assertEquals(false, $message->getMerge());
$message->addGlobalMergeVar('testkey', 'testvalue');
$this->assertEquals(true, $message->getMerge());
}

}

0 comments on commit d5d7b8c

Please sign in to comment.