Skip to content

Commit 3d7cf7e

Browse files
committed
Code style, fix typos, tweak tests
1 parent 7cd02a9 commit 3d7cf7e

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

src/CssInlinerPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function loadCssFilesFromLinks($message)
103103
}
104104

105105
$link_tags = $dom->getElementsByTagName('link');
106-
for ($i = $link_tags->length; --$i >= 0; ) {
106+
for ($i = $link_tags->length; --$i >= 0;) {
107107
$link = $link_tags->item($i);
108108
if ($link->getAttribute('rel') === 'stylesheet') {
109109
$link->parentNode->removeChild($link);

tests/CssInlinerPluginTest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function itShouldConvertHtmlBody()
6060

6161
$mailer->send($message);
6262

63-
$this->assertXmlStringEqualsXmlString(
63+
$this->assertEquals(
6464
$this->stubs['converted-html'],
6565
$this->normalize($message->getBody())
6666
);
@@ -106,10 +106,7 @@ public function itShouldConvertHtmlBodyAndTextParts()
106106

107107
$children = $message->getChildren();
108108

109-
$this->assertXmlStringEqualsXmlString(
110-
$this->stubs['converted-html'],
111-
$this->normalize($message->getBody())
112-
);
109+
$this->assertEquals($this->stubs['converted-html'], $this->normalize($message->getBody()));
113110
$this->assertEquals($this->stubs['plain-text'], $children[0]->getBody());
114111
}
115112

@@ -150,10 +147,7 @@ public function itShouldConvertHtmlBodyAsAPart()
150147

151148
$children = $message->getChildren();
152149

153-
$this->assertXmlStringEqualsXmlString(
154-
$this->stubs['converted-html'],
155-
$this->normalize($children[0]->getBody())
156-
);
150+
$this->assertEquals($this->stubs['converted-html'], $this->normalize($children[0]->getBody()));
157151
}
158152

159153
/** @test **/
@@ -256,7 +250,7 @@ protected function normalize(string $html): string
256250
'/(?:<head>)(\s)+(?:<\/head>)/s', // libxml handles this different across platforms
257251
];
258252

259-
$replace = [,
253+
$replace = [
260254
'<head></head>',
261255
];
262256

tests/stubs/converted-html.stub

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@
99
div.block ul li.small {
1010
margin: 10px;
1111
}
12+
.picture-feed {
13+
width: 50%;
14+
}
15+
@media (max-width: 768px) {
16+
.picture-feed {
17+
width: 100%;
18+
}
19+
}
1220
</style>
1321
</head>
1422
<body>
23+
<div><img class="picture-feed" src="foo.jpg" style="width: 50%;"></div>
1524
<div class="block" style="width: 100px; height: 20px;">
1625
text
1726

tests/stubs/original-html.stub

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@
99
div.block ul li.small {
1010
margin: 10px;
1111
}
12+
.picture-feed {
13+
width: 50%;
14+
}
15+
@media (max-width: 768px) {
16+
.picture-feed {
17+
width: 100%;
18+
}
19+
}
1220
</style>
1321
</head>
1422
<body>
23+
<div><img class="picture-feed" src="foo.jpg"></div>
1524
<div class="block">
1625
text
1726

0 commit comments

Comments
 (0)