X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fbookmark%2FLinkUtilsTest.php;h=46a7f1fe7a4fd42b749bee30bd455d41ccdc107a;hb=88a8e284b2825cbd77c75dbbbf3655a961d9eb09;hp=c2f9f9305716829b91ba6ffe36cfc9a8a29cb80e;hpb=b3bd8c3e8d367975980043e772f7cd78b7f96bc6;p=github%2Fshaarli%2FShaarli.git
diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php
index c2f9f930..46a7f1fe 100644
--- a/tests/bookmark/LinkUtilsTest.php
+++ b/tests/bookmark/LinkUtilsTest.php
@@ -168,6 +168,36 @@ class LinkUtilsTest extends TestCase
$this->assertEquals($description, html_extract_tag('description', $html));
}
+ /**
+ * Test html_extract_tag() with double quoted content containing single quote, and the opposite.
+ */
+ public function testHtmlExtractExistentNameTagWithMixedQuotes(): void
+ {
+ $description = 'Bob and Alice share M&M\'s.';
+
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ $description = 'Bob and Alice share "cookies".';
+
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+ }
+
/**
* Test html_extract_tag() when the tag assertFalse(html_extract_tag('description', $html));
}
+ public function testHtmlExtractDescriptionFromGoogleRealCase(): void
+ {
+ $html = 'id="gsr">'.
+ ''.
+ 'assertSame('Bonnes fêtes de fin d\'année ! #GoogleDoodle', html_extract_tag('description', $html));
+ }
+
/**
* Test the header callback with valid value
*/