<?php
namespace App\Tests\Unit\Service\Utils;

use App\Service\Utils\StringsUtils;
use PHPUnit\Framework\TestCase;

class StringsUtilsTest extends TestCase
{
    /**
     * @see StringsUtils::unquote()
     */
    public function testUnquote():void
    {
        $this->assertEquals("foo", StringsUtils::unquote("'foo"));
    }

    /**
     * @see StringsUtils::camelToSnake()
     */
    public function testCamelToSnake(): void {
        $this->assertEquals("foo_bar", StringsUtils::camelToSnake("FooBar"));
        $this->assertEquals("foo-bar", StringsUtils::camelToSnake("FooBar", '-'));
        $this->assertEquals("foo_bar", StringsUtils::camelToSnake("fooBar"));
    }

    /**
     * @see StringsUtils::convertHtmlToText()
     */
    public function testConvertHtmlToText(): void {
        $this->assertEquals("Test contenu", (new StringsUtils())->convertHtmlToText("<table><tr><td>Test</td></tr></table> <br /><p>contenu</p>"));
    }
}
