<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
*/
public function testGetRelevantUrlFromBody($expected, string $body, bool $searchNakedUrls = false)
{
- $this->assertSame($expected, PageInfoMock::getRelevantUrlFromBody($body, $searchNakedUrls));
+ self::assertSame($expected, PageInfoMock::getRelevantUrlFromBody($body, $searchNakedUrls));
}
public function dataStripTrailingUrlFromBody()
'body' => '[url=https://example.com]link label[/url]',
'url' => 'https://example.com',
],
+ 'task-8797-shortened-link-label' => [
+ 'expected' => 'content',
+ 'body' => 'content [url=https://example.com/page]example.com/[/url]',
+ 'url' => 'https://example.com/page',
+ ],
+ 'task-8797-shortened-link-label-ellipsis' => [
+ 'expected' => 'content',
+ 'body' => 'content [url=https://example.com/page]example.com…[/url]',
+ 'url' => 'https://example.com/page',
+ ],
+ 'task-8797-shortened-link-label-dots' => [
+ 'expected' => 'content',
+ 'body' => 'content [url=https://example.com/page]example.com...[/url]',
+ 'url' => 'https://example.com/page',
+ ],
];
}
*/
public function testStripTrailingUrlFromBody(string $expected, string $body, string $url)
{
- $this->assertSame($expected, PageInfoMock::stripTrailingUrlFromBody($body, $url));
+ self::assertSame($expected, PageInfoMock::stripTrailingUrlFromBody($body, $url));
}
}