Fix a lot of notices/warnings/deprecation notes in the test directory
This commit is contained in:
parent
efaec26b1d
commit
d55ecb9288
77 changed files with 428 additions and 558 deletions
|
@ -27,6 +27,6 @@ class ItemTest extends MockedTest
|
|||
{
|
||||
public function testDetermineCategoriesTerms()
|
||||
{
|
||||
$this->markTestIncomplete('Test data needed.');
|
||||
static::markTestIncomplete('Test data needed.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
namespace Friendica\Test\src\Content;
|
||||
|
||||
use Friendica\Content\PageInfo;
|
||||
|
||||
/**
|
||||
* Class PageInfoMock
|
||||
*
|
||||
|
@ -29,7 +31,7 @@ namespace Friendica\Test\src\Content;
|
|||
* @method static string|null getRelevantUrlFromBody(string $body, $searchNakedUrls = false)
|
||||
* @method static string stripTrailingUrlFromBody(string $body, string $url)
|
||||
*/
|
||||
class PageInfoMock extends \Friendica\Content\PageInfo
|
||||
class PageInfoMock extends PageInfo
|
||||
{
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
namespace Friendica\Test\src\Content;
|
||||
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\AppMockTrait;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
|
@ -52,14 +53,16 @@ class SmiliesTest extends MockedTest
|
|||
|
||||
/**
|
||||
* Test replace smilies in different texts
|
||||
*
|
||||
* @dataProvider dataLinks
|
||||
*
|
||||
* @param string $text Test string
|
||||
* @param array $smilies List of smilies to replace
|
||||
* @param string $expected Expected result
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function testReplaceFromArray($text, $smilies, $expected)
|
||||
public function testReplaceFromArray(string $text, array $smilies, string $expected)
|
||||
{
|
||||
$output = Smilies::replaceFromArray($text, $smilies);
|
||||
self::assertEquals($expected, $output);
|
||||
|
|
|
@ -24,9 +24,11 @@ namespace Friendica\Test\src\Content\Text;
|
|||
use Friendica\App\BaseURL;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\AppMockTrait;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use Mockery;
|
||||
|
||||
class BBCodeTest extends MockedTest
|
||||
{
|
||||
|
@ -62,13 +64,13 @@ class BBCodeTest extends MockedTest
|
|||
->with('system', 'big_emojis')
|
||||
->andReturn(false);
|
||||
|
||||
$l10nMock = \Mockery::mock(L10n::class);
|
||||
$l10nMock = Mockery::mock(L10n::class);
|
||||
$l10nMock->shouldReceive('t')->withAnyArgs()->andReturnUsing(function ($args) { return $args; });
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(L10n::class)
|
||||
->andReturn($l10nMock);
|
||||
|
||||
$baseUrlMock = \Mockery::mock(BaseURL::class);
|
||||
$baseUrlMock = Mockery::mock(BaseURL::class);
|
||||
$baseUrlMock->shouldReceive('get')->withAnyArgs()->andReturn('friendica.local');
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(BaseURL::class)
|
||||
|
@ -158,13 +160,15 @@ class BBCodeTest extends MockedTest
|
|||
|
||||
/**
|
||||
* Test convert different links inside a text
|
||||
*
|
||||
* @dataProvider dataLinks
|
||||
*
|
||||
* @param string $data The data to text
|
||||
* @param bool $assertHTML True, if the link is a HTML link (<a href...>...</a>)
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @param string $data The data to text
|
||||
* @param bool $assertHTML True, if the link is a HTML link (<a href...>...</a>)
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function testAutoLinking($data, $assertHTML)
|
||||
public function testAutoLinking(string $data, bool $assertHTML)
|
||||
{
|
||||
$output = BBCode::convert($data);
|
||||
$assert = '<a href="' . $data . '" target="_blank" rel="noopener noreferrer">' . $data . '</a>';
|
||||
|
@ -258,9 +262,10 @@ class BBCodeTest extends MockedTest
|
|||
* @param bool $try_oembed Whether to convert multimedia BBCode tag
|
||||
* @param int $simpleHtml BBCode::convert method $simple_html parameter value, optional.
|
||||
* @param bool $forPlaintext BBCode::convert method $for_plaintext parameter value, optional.
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function testConvert($expectedHtml, $text, $try_oembed = false, $simpleHtml = 0, $forPlaintext = false)
|
||||
public function testConvert(string $expectedHtml, string $text, $try_oembed = false, int $simpleHtml = 0, bool $forPlaintext = false)
|
||||
{
|
||||
$actual = BBCode::convert($text, $try_oembed, $simpleHtml, $forPlaintext);
|
||||
|
||||
|
@ -290,12 +295,13 @@ class BBCodeTest extends MockedTest
|
|||
*
|
||||
* @dataProvider dataBBCodesToMarkdown
|
||||
*
|
||||
* @param string $expected Expected Markdown output
|
||||
* @param string $text BBCode text
|
||||
* @param string $expected Expected Markdown output
|
||||
* @param string $text BBCode text
|
||||
* @param bool $for_diaspora
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function testToMarkdown($expected, $text, $for_diaspora = false)
|
||||
public function testToMarkdown(string $expected, string $text, $for_diaspora = false)
|
||||
{
|
||||
$actual = BBCode::toMarkdown($text, $for_diaspora);
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
|
||||
namespace Friendica\Test\src\Content\Text;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\AppMockTrait;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
|
@ -61,9 +63,10 @@ class HTMLTest extends MockedTest
|
|||
*
|
||||
* @param string $input The Markdown text to test
|
||||
* @param string $expected The expected HTML output
|
||||
* @throws \Exception
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testToPlaintext($input, $expected)
|
||||
public function testToPlaintext(string $input, string $expected)
|
||||
{
|
||||
$output = HTML::toPlaintext($input, 0);
|
||||
|
||||
|
@ -91,9 +94,10 @@ class HTMLTest extends MockedTest
|
|||
*
|
||||
* @param string $expectedBBCode Expected BBCode output
|
||||
* @param string $html HTML text
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function testToBBCode($expectedBBCode, $html)
|
||||
public function testToBBCode(string $expectedBBCode, string $html)
|
||||
{
|
||||
$actual = HTML::toBBCode($html);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Content\Text;
|
||||
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Exception;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\AppMockTrait;
|
||||
|
@ -57,13 +57,15 @@ class MarkdownTest extends MockedTest
|
|||
|
||||
/**
|
||||
* Test convert different input Markdown text into HTML
|
||||
*
|
||||
* @dataProvider dataMarkdown
|
||||
*
|
||||
* @param string $input The Markdown text to test
|
||||
* @param string $expected The expected HTML output
|
||||
* @throws \Exception
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testConvert($input, $expected)
|
||||
public function testConvert(string $input, string $expected)
|
||||
{
|
||||
$output = Markdown::convert($input);
|
||||
|
||||
|
@ -87,9 +89,8 @@ class MarkdownTest extends MockedTest
|
|||
*
|
||||
* @param string $expectedBBCode Expected BBCode output
|
||||
* @param string $html Markdown text
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function testToBBCode($expectedBBCode, $html)
|
||||
public function testToBBCode(string $expectedBBCode, string $html)
|
||||
{
|
||||
$actual = Markdown::toBBCode($html);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue