StringsUtilsTest.php 944 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Tests\Service\Utils;
  3. use App\Service\Utils\StringsUtils;
  4. use PHPUnit\Framework\TestCase;
  5. class StringsUtilsTest extends TestCase
  6. {
  7. /**
  8. * @see StringsUtils::unquote()
  9. */
  10. public function testUnquote():void
  11. {
  12. $this->assertEquals("foo", StringsUtils::unquote("'foo"));
  13. }
  14. /**
  15. * @see StringsUtils::camelToSnake()
  16. */
  17. public function testCamelToSnake(): void {
  18. $this->assertEquals("foo_bar", StringsUtils::camelToSnake("FooBar"));
  19. $this->assertEquals("foo-bar", StringsUtils::camelToSnake("FooBar", '-'));
  20. $this->assertEquals("foo_bar", StringsUtils::camelToSnake("fooBar"));
  21. }
  22. /**
  23. * @see StringsUtils::convertHtmlToText()
  24. */
  25. public function testConvertHtmlToText(): void {
  26. $this->assertEquals("Test contenu", (new StringsUtils())->convertHtmlToText("<table><tr><td>Test</td></tr></table> <br /><p>contenu</p>"));
  27. }
  28. }