<?php

namespace Rasb14\Util;

use PHPUnit\Framework\TestCase;

class TextFilterTest extends TestCase
{
    /**
     * Testing create object.
     */
    public function testCreateObject()
    {
        $tf = new TextFilter();
        $this->assertInstanceOf("\Rasb14\Util\TextFilter", $tf);
        $this->assertEquals([
            "bbcode"    => "bbcode2html",
            "link"      => "makeClickable",
            "markdown"  => "markdown",
            "nl2br"     => "nl2br",
            "escaped"   => "esc",
            "tagstrip"  => "strip",
        ], $tf->filters());
    }

    /**
     * Testing parse.
     */
    public function testParse()
    {
        $tf = new TextFilter();
        $this->assertEquals('<a href="https://gigavoid.com">hello</a>', $tf->parse("[hello](https://gigavoid.com)", ["markdown"]));
    }
}
