Page MenuHomePhabricator (Chris)

EntityTest.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

EntityTest.php

<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Tests\Unit\Entities;
use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Tests\Unit\TestCase;
/**
* @link https://github.com/php-telegram-bot/core
* @author Baev Nikolay <gametester3d@gmail.com>
* @copyright Avtandil Kikabidze <akalongman@gmail.com>
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
* @package TelegramTest
*/
class EntityTest extends TestCase
{
public function testEscapeMarkdown(): void
{
// Make sure all characters that need escaping are escaped.
// Markdown V1
self::assertEquals('\[\`\*\_', Entity::escapeMarkdown('[`*_'));
self::assertEquals('\*mark\*\_down\_~test~', Entity::escapeMarkdown('*mark*_down_~test~'));
// Markdown V2
self::assertEquals('\_\*\[\]\(\)\~\`\>\#\+\-\=\|\{\}\.\!', Entity::escapeMarkdownV2('_*[]()~`>#+-=|{}.!'));
self::assertEquals('\*mark\*\_down\_\~test\~', Entity::escapeMarkdownV2('*mark*_down_~test~'));
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Nov 15, 4:26 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
152468
Default Alt Text
EntityTest.php (1 KB)

Event Timeline