namespace Shaarli\Bookmark;
-use PHPUnit\Framework\TestCase;
+use Shaarli\TestCase;
require_once 'tests/utils/CurlUtils.php';
$this->assertEquals(strtolower($charset), header_extract_charset($headers));
}
+ /**
+ * Test headers_extract_charset() when the charset is found with odd quotes.
+ */
+ public function testHeadersExtractExistentCharsetWithQuotes()
+ {
+ $charset = 'x-MacCroatian';
+ $headers = 'text/html; charset="' . $charset . '"otherstuff="test"';
+ $this->assertEquals(strtolower($charset), header_extract_charset($headers));
+
+ $headers = 'text/html; charset=\'' . $charset . '\'otherstuff="test"';
+ $this->assertEquals(strtolower($charset), header_extract_charset($headers));
+ }
+
/**
* Test headers_extract_charset() when the charset is not found.
*/
カタカナ #カタカナ」カタカナ\n';
$autolinkedDescription = hashtag_autolink($rawDescription, $index);
- $this->assertContains($this->getHashtagLink('hashtag', $index), $autolinkedDescription);
- $this->assertNotContains(' #hashtag', $autolinkedDescription);
- $this->assertNotContains('>#nothashtag', $autolinkedDescription);
- $this->assertContains($this->getHashtagLink('ашок', $index), $autolinkedDescription);
- $this->assertContains($this->getHashtagLink('カタカナ', $index), $autolinkedDescription);
- $this->assertContains($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription);
- $this->assertNotContains($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription);
+ $this->assertContainsPolyfill($this->getHashtagLink('hashtag', $index), $autolinkedDescription);
+ $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription);
+ $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription);
+ $this->assertContainsPolyfill($this->getHashtagLink('ашок', $index), $autolinkedDescription);
+ $this->assertContainsPolyfill($this->getHashtagLink('カタカナ', $index), $autolinkedDescription);
+ $this->assertContainsPolyfill($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription);
+ $this->assertNotContainsPolyfill($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription);
}
/**
$rawDescription = 'blabla #hashtag x#nothashtag';
$autolinkedDescription = hashtag_autolink($rawDescription);
- $this->assertContains($this->getHashtagLink('hashtag'), $autolinkedDescription);
- $this->assertNotContains(' #hashtag', $autolinkedDescription);
- $this->assertNotContains('>#nothashtag', $autolinkedDescription);
+ $this->assertContainsPolyfill($this->getHashtagLink('hashtag'), $autolinkedDescription);
+ $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription);
+ $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription);
}
/**