1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 00:14:38 +01:00

More unit tests

This commit is contained in:
Daniil Gentili 2022-07-28 19:07:34 +02:00
parent fd03bdec63
commit 1873d97dda
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 24 additions and 0 deletions

View File

@ -35,6 +35,8 @@ class EntitiesTest extends MadelineTestCase
}
public function provideEntities(): array
{
$this->setUpBeforeClass();
$mention = self::$MadelineProto->getPwrChat(getenv('TEST_USERNAME'));
return [
[
'html',
@ -161,6 +163,25 @@ class EntitiesTest extends MadelineTestCase
]
]
],
[
'html',
'<a href="mention:'.getenv('TEST_USERNAME').'">mention1</a> <a href="tg://user?id='.getenv('TEST_USERNAME').'">mention2</a>',
'mention1 mention2',
[
[
'offset' => 0,
'length' => 8,
'type' => 'text_mention',
'user' => $mention
],
[
'offset' => 9,
'length' => 8,
'type' => 'text_mention',
'user' => $mention
]
]
],
[
'markdown',
'test *italic* **bold** <u>underlined</u> ~~strikethrough~~ <pre language="test">pre</pre> <code>code</code> <spoiler>spoiler</spoiler>',

View File

@ -22,6 +22,9 @@ abstract class MadelineTestCase extends TestCase
*/
public static function setUpBeforeClass(): void
{
if (self::$MadelineProto !== null) {
return;
}
self::$MadelineProto = new API(
'testing.madeline',
[