Skip to content

Commit

Permalink
[BUGFIX] Fix failing tests on Windows due to line endings
Browse files Browse the repository at this point in the history
Fixes #253
  • Loading branch information
oliverklee committed Oct 13, 2015
1 parent d4cbede commit 3d12f38
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ subject to breaking changes without deprecation notices.


### Fixed
- Fix failing tests on Windows due to line endings
([#263](https://github.com/jjriv/emogrifier/pull/263))
- Parsing CSS declaration blocks
([#261](https://github.com/jjriv/emogrifier/pull/261))
- Fix first-child and last-child selectors
Expand Down
26 changes: 17 additions & 9 deletions Tests/Unit/EmogrifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
*/
class EmogrifierTest extends \PHPUnit_Framework_TestCase
{
/**
* @var string
*/
const LF = "\n";

/**
* @var string
*/
Expand Down Expand Up @@ -740,8 +745,11 @@ public function formattedCssDeclarationDataProvider()
'two declarations separated by semicolon' => ['color: #000;width: 3px;', 'color: #000; width: 3px;'],
'two declarations separated by semicolon and space'
=> ['color: #000; width: 3px;', 'color: #000; width: 3px;'],
'two declaration separated by semicolon and Linefeed' => [
'color: #000;' . PHP_EOL . 'width: 3px;', 'color: #000; width: 3px;'
'two declarations separated by semicolon and linefeed' => [
'color: #000;' . self::LF . 'width: 3px;', 'color: #000; width: 3px;'
],
'two declarations separated by semicolon and Windows line ending' => [
"color: #000;\r\nwidth: 3px;", 'color: #000; width: 3px;'
],
'one declaration with leading dash in property name' => [
'-webkit-text-size-adjust:none;', '-webkit-text-size-adjust: none;'
Expand Down Expand Up @@ -1596,11 +1604,11 @@ public function emogrifyReturnsCompleteHtmlDocument()
$this->subject->setHtml($this->html5DocumentType . '<html><body><p></p></body></html>');

self::assertSame(
$this->html5DocumentType . PHP_EOL .
'<html>' . PHP_EOL .
'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>' . PHP_EOL .
'<body><p></p></body>' . PHP_EOL .
'</html>' . PHP_EOL,
$this->html5DocumentType . self::LF .
'<html>' . self::LF .
'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>' . self::LF .
'<body><p></p></body>' . self::LF .
'</html>' . self::LF,
$this->subject->emogrify()
);
}
Expand All @@ -1612,7 +1620,7 @@ public function emogrifyBodyContentReturnsBodyContentFromHtml()
{
$this->subject->setHtml($this->html5DocumentType . '<html><body><p></p></body></html>');
self::assertSame(
'<p></p>' . PHP_EOL,
'<p></p>' . self::LF,
$this->subject->emogrifyBodyContent()
);
}
Expand All @@ -1624,7 +1632,7 @@ public function emogrifyBodyContentReturnsBodyContentFromContent()
{
$this->subject->setHtml('<p></p>');
self::assertSame(
'<p></p>' . PHP_EOL,
'<p></p>' . self::LF,
$this->subject->emogrifyBodyContent()
);
}
Expand Down

0 comments on commit 3d12f38

Please sign in to comment.