diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2021-03-29 21:30:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 21:30:04 +0300 |
commit | b848f3bfd449f03041eaffe1cd4b4151e65990f1 (patch) | |
tree | 709f58d18d6967c52210d9878038dd5843988cff /tests | |
parent | 7a51a14e9f04c993b664cb5b4fe673fe75258b14 (diff) | |
parent | 4c2354f67dc90e9ad254fbcfe070cf3e35dbc5e0 (diff) |
Merge pull request #4836 from nextcloud/techdept/urllinker-fork
Replace abandoned kwi urllinker with a maintained fork
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Unit/Service/HtmlTest.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/Unit/Service/HtmlTest.php b/tests/Unit/Service/HtmlTest.php index ed3b4ae6b..778068d3c 100644 --- a/tests/Unit/Service/HtmlTest.php +++ b/tests/Unit/Service/HtmlTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author Thomas Müller <thomas.mueller@tmit.eu> @@ -25,6 +27,8 @@ namespace OCA\Mail\Tests\Unit\Service; use ChristophWurst\Nextcloud\Testing\TestCase; use OC; use OCA\Mail\Service\Html; +use OCP\IRequest; +use OCP\IURLGenerator; class HtmlTest extends TestCase { @@ -33,19 +37,21 @@ class HtmlTest extends TestCase { * @param $expected * @param $text */ - public function testLinkDetection($expected, $text) { - $urlGenerator = OC::$server->getURLGenerator(); - $request = OC::$server->getRequest(); + public function testLinkDetection(string $expected, string $text) { + $urlGenerator = OC::$server->get(IURLGenerator::class); + $request = OC::$server->get(IRequest::class); + $html = new Html($urlGenerator, $request); $withLinks = $html->convertLinks($text); - $this->assertSame($expected, $withLinks); + + self::assertSame($expected, $withLinks); } public function linkDetectionProvider() { return [ ['abc', 'abc'], ['<>', '<>'], - ['&lt;&gt;', '<>'], + ['<>', '<>'], // no double encoding ['foo&bar', 'foo&bar'], ['<a href="http://google.com" rel="noreferrer noopener" target="_blank">google.com</a>', 'http://google.com'], ['<a href="https://google.com" rel="noreferrer noopener" target="_blank">google.com</a>', 'https://google.com'], |