55use Monolog \Handler \TestHandler ;
66use Monolog \Logger ;
77use Psr \Log \LoggerInterface ;
8- use Readability \JSLikeHTMLElement ;
98use Readability \Readability ;
109
1110class ReadabilityTest extends \PHPUnit \Framework \TestCase
@@ -80,8 +79,6 @@ public function testInitNoContent(): void
8079 $ res = $ readability ->init ();
8180
8281 $ this ->assertFalse ($ res );
83- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
84- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
8582 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
8683 $ this ->assertStringContainsString ('Sorry, Readability was unable to parse this page for content. ' , $ readability ->getContent ()->getInnerHtml ());
8784 }
@@ -92,8 +89,6 @@ public function testInitP(): void
9289 $ res = $ readability ->init ();
9390
9491 $ this ->assertTrue ($ res );
95- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
96- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
9792 $ this ->assertStringContainsString ('<div readability= ' , $ readability ->getContent ()->getInnerHtml ());
9893 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
9994 $ this ->assertStringContainsString ('This is the awesome content :) ' , $ readability ->getContent ()->getInnerHtml ());
@@ -105,8 +100,6 @@ public function testInitDivP(): void
105100 $ res = $ readability ->init ();
106101
107102 $ this ->assertTrue ($ res );
108- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
109- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
110103 $ this ->assertStringContainsString ('<div readability= ' , $ readability ->getContent ()->getInnerHtml ());
111104 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
112105 $ this ->assertStringContainsString ('This is the awesome content :) ' , $ readability ->getContent ()->getInnerHtml ());
@@ -119,8 +112,6 @@ public function testInitDiv(): void
119112 $ res = $ readability ->init ();
120113
121114 $ this ->assertTrue ($ res );
122- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
123- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
124115 $ this ->assertStringContainsString ('<div readability= ' , $ readability ->getContent ()->getInnerHtml ());
125116 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
126117 $ this ->assertStringContainsString ('This is the awesome content :) ' , $ readability ->getContent ()->getInnerHtml ());
@@ -134,8 +125,6 @@ public function testWithFootnotes(): void
134125 $ res = $ readability ->init ();
135126
136127 $ this ->assertTrue ($ res );
137- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
138- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
139128 $ this ->assertStringContainsString ('<div readability= ' , $ readability ->getContent ()->getInnerHtml ());
140129 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
141130 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
@@ -151,8 +140,6 @@ public function testStandardClean(): void
151140 $ res = $ readability ->init ();
152141
153142 $ this ->assertTrue ($ res );
154- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
155- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
156143 $ this ->assertStringContainsString ('<div readability= ' , $ readability ->getContent ()->getInnerHtml ());
157144 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
158145 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
@@ -167,8 +154,6 @@ public function testWithIframe(): void
167154 $ res = $ readability ->init ();
168155
169156 $ this ->assertTrue ($ res );
170- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
171- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
172157 $ this ->assertStringContainsString ('<div readability= ' , $ readability ->getContent ()->getInnerHtml ());
173158 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
174159 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
@@ -182,8 +167,6 @@ public function testWithArticle(): void
182167 $ res = $ readability ->init ();
183168
184169 $ this ->assertTrue ($ res );
185- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
186- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
187170 $ this ->assertStringContainsString ('alt="article" ' , $ readability ->getContent ()->getInnerHtml ());
188171 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
189172 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
@@ -197,8 +180,6 @@ public function testWithAside(): void
197180 $ res = $ readability ->init ();
198181
199182 $ this ->assertTrue ($ res );
200- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
201- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
202183 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
203184 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
204185 $ this ->assertStringNotContainsString ('<aside> ' , $ readability ->getContent ()->getInnerHtml ());
@@ -212,8 +193,6 @@ public function testWithClasses(): void
212193 $ res = $ readability ->init ();
213194
214195 $ this ->assertTrue ($ res );
215- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
216- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
217196 $ this ->assertStringContainsString ('alt="article" ' , $ readability ->getContent ()->getInnerHtml ());
218197 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
219198 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
@@ -228,8 +207,6 @@ public function testWithClassesWithoutLightClean(): void
228207 $ res = $ readability ->init ();
229208
230209 $ this ->assertTrue ($ res );
231- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
232- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
233210 $ this ->assertStringContainsString ('alt="article" ' , $ readability ->getContent ()->getInnerHtml ());
234211 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
235212 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
@@ -243,8 +220,6 @@ public function testWithTd(): void
243220 $ res = $ readability ->init ();
244221
245222 $ this ->assertTrue ($ res );
246- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
247- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
248223 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
249224 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
250225 }
@@ -256,8 +231,6 @@ public function testWithSameClasses(): void
256231 $ res = $ readability ->init ();
257232
258233 $ this ->assertTrue ($ res );
259- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
260- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
261234 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
262235 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
263236 $ this ->assertStringContainsString ('This text is also an awesome text and you should know that ' , $ readability ->getContent ()->getInnerHtml ());
@@ -270,8 +243,6 @@ public function testWithScript(): void
270243 $ res = $ readability ->init ();
271244
272245 $ this ->assertTrue ($ res );
273- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
274- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
275246 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
276247 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
277248 $ this ->assertStringNotContainsString ('This text is also an awesome text and you should know that ' , $ readability ->getContent ()->getInnerHtml ());
@@ -284,8 +255,6 @@ public function testTitle(): void
284255 $ res = $ readability ->init ();
285256
286257 $ this ->assertTrue ($ res );
287- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
288- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
289258 $ this ->assertSame ('this is my title ' , $ readability ->getTitle ()->getInnerHtml ());
290259 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
291260 $ this ->assertStringNotContainsString ('This text is also an awesome text and you should know that ' , $ readability ->getContent ()->getInnerHtml ());
@@ -298,8 +267,6 @@ public function testTitleWithDash(): void
298267 $ res = $ readability ->init ();
299268
300269 $ this ->assertTrue ($ res );
301- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
302- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
303270 $ this ->assertSame ('title2 - title3 ' , $ readability ->getTitle ()->getInnerHtml ());
304271 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
305272 $ this ->assertStringNotContainsString ('This text is also an awesome text and you should know that ' , $ readability ->getContent ()->getInnerHtml ());
@@ -312,8 +279,6 @@ public function testTitleWithDoubleDot(): void
312279 $ res = $ readability ->init ();
313280
314281 $ this ->assertTrue ($ res );
315- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
316- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
317282 $ this ->assertSame ('title2 : title3 ' , $ readability ->getTitle ()->getInnerHtml ());
318283 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
319284 $ this ->assertStringNotContainsString ('This text is also an awesome text and you should know that ' , $ readability ->getContent ()->getInnerHtml ());
@@ -326,8 +291,6 @@ public function testTitleTooShortUseH1(): void
326291 $ res = $ readability ->init ();
327292
328293 $ this ->assertTrue ($ res );
329- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
330- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
331294 $ this ->assertSame ('this is my h1 title ! ' , $ readability ->getTitle ()->getInnerHtml ());
332295 $ this ->assertStringContainsString ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
333296 $ this ->assertStringNotContainsString ('This text is also an awesome text and you should know that ' , $ readability ->getContent ()->getInnerHtml ());
@@ -374,8 +337,6 @@ public function testAutoClosingIframeNotThrowingException(): void
374337 $ res = $ readability ->init ();
375338
376339 $ this ->assertTrue ($ res );
377- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
378- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
379340 $ this ->assertStringContainsString ('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe> ' , $ readability ->getContent ()->getInnerHtml ());
380341 $ this ->assertStringContainsString ('3D Touch ' , $ readability ->getTitle ()->getInnerHtml ());
381342 } finally {
@@ -442,8 +403,6 @@ public function testAppendIdAlreadyHere(): void
442403 $ res = $ readability ->init ();
443404
444405 $ this ->assertTrue ($ res );
445- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getContent ());
446- $ this ->assertInstanceOf (JSLikeHTMLElement::class, $ readability ->getTitle ());
447406 }
448407
449408 public function testPostFilters (): void
0 commit comments