<?PHP
/**
 * Tests for MD_STD_IN.
 *
 * @author Joshua Ramon Enslin <joshua@museum-digital.de>
 */
declare(strict_types = 1);

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\CoversClass;

/**
 * Tests for MD_STD_IN.
 */
#[small]
#[CoversClass(\MDFormatter::class)]
final class MDFormatterTest extends TestCase {
    /**
     * Function for testing formatMarkdownHeadline1().
     *
     * @return void
     */
    public function testFormatMarkdownHeadline1():void {

        self::assertEquals("a" . PHP_EOL . "=" . PHP_EOL . PHP_EOL, MDFormatter::formatMarkdownHeadline1("a"));

    }

    /**
     * Function for testing formatMarkdownHeadline2().
     *
     * @return void
     */
    public function testFormatMarkdownHeadline2():void {

        self::assertEquals("a" . PHP_EOL . "-" . PHP_EOL . PHP_EOL, MDFormatter::formatMarkdownHeadline2("a"));

    }

    /**
     * Function for testing formatMarkdownHeadline3().
     *
     * @return void
     */
    public function testFormatMarkdownHeadline3():void {

        self::assertEquals("### a" . PHP_EOL, MDFormatter::formatMarkdownHeadline3("a"));

    }

    /**
     * Function for testing formatMarkdownHorizontalRule().
     *
     * @return void
     */
    public function testFormatMarkdownHorizontalRule():void {

        self::assertEquals("___" . PHP_EOL, MDFormatter::formatMarkdownHorizontalRule());

    }

    /**
     * Function for testing formatMarkdownNamedLink().
     *
     * @return void
     */
    public function testFormatMarkdownNamedLink():void {

        self::assertEquals("[a](https://example.com)", MDFormatter::formatMarkdownNamedLink("a", "https://example.com"));

    }

    /**
     * Function for testing formatMarkdownBlockQuote().
     *
     * @return void
     */
    public function testFormatMarkdownBlockQuote():void {

        self::assertEquals("> Test" . PHP_EOL . "> test" . PHP_EOL, MDFormatter::formatMarkdownBlockQuote("Test" . PHP_EOL . "test"));

    }

    /**
     * Function for testing formatMarkdownCodeBlock().
     *
     * @return void
     */
    public function testFormatMarkdownCodeBlock():void {

        self::assertEquals("```" . PHP_EOL . "Test" . PHP_EOL . "test" . PHP_EOL . "```" . PHP_EOL, MDFormatter::formatMarkdownCodeBlock("Test" . PHP_EOL . "test"));

    }

    /**
     * Function for testing formatMarkdownUnorderedListItem().
     *
     * @return void
     */
    public function testFormatMarkdownUnorderedListItem():void {

        self::assertEquals("- a" . PHP_EOL, MDFormatter::formatMarkdownUnorderedListItem("a"));
        self::assertEquals("- a" . PHP_EOL . "  a" . PHP_EOL, MDFormatter::formatMarkdownUnorderedListItem("a" . PHP_EOL . "a"));

    }
}