X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fbookmark%2FLinkUtilsTest.php;h=29941c8cd0ed32307faa0eea5bde9b99b3d77967;hb=458b6b9918ec27154dd45416947bb93bedb97109;hp=ef00b92f8c3bce554b2dd56e518fa27bb4578a59;hpb=7b18876361f2223672f3a2cac9fc0da16d12d69f;p=github%2Fshaarli%2FShaarli.git
diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php
index ef00b92f..29941c8c 100644
--- a/tests/bookmark/LinkUtilsTest.php
+++ b/tests/bookmark/LinkUtilsTest.php
@@ -94,8 +94,78 @@ class LinkUtilsTest extends TestCase
public function testHtmlExtractExistentNameTag()
{
$description = 'Bob and Alice share cookies.';
+
+ // Simple one line
$html = 'stuff2';
$this->assertEquals($description, html_extract_tag('description', $html));
+
+ // Simple OpenGraph
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // Simple reversed OpenGraph
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // ItemProp OpenGraph
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph without quotes
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph reversed without quotes
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph with noise
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph reversed with noise
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph multiple properties start
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph multiple properties end
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph multiple properties both end
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph multiple properties both end with noise
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph reversed multiple properties start
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph reversed multiple properties end
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph reversed multiple properties both end
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // OpenGraph reversed multiple properties both end with noise
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
+
+ // Suggestion from #1375
+ $html = '';
+ $this->assertEquals($description, html_extract_tag('description', $html));
}
/**
@@ -105,6 +175,25 @@ class LinkUtilsTest extends TestCase
{
$html = 'stuff2';
$this->assertFalse(html_extract_tag('description', $html));
+
+ // Partial meta tag
+ $html = '';
+ $this->assertFalse(html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertFalse(html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertFalse(html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertFalse(html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertFalse(html_extract_tag('description', $html));
+
+ $html = '';
+ $this->assertFalse(html_extract_tag('description', $html));
}
/**