StringsUtilsTest.php 959 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Tests\Unit\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. {
  19. $this->assertEquals('foo_bar', StringsUtils::camelToSnake('FooBar'));
  20. $this->assertEquals('foo-bar', StringsUtils::camelToSnake('FooBar', '-'));
  21. $this->assertEquals('foo_bar', StringsUtils::camelToSnake('fooBar'));
  22. }
  23. /**
  24. * @see StringsUtils::convertHtmlToText()
  25. */
  26. public function testConvertHtmlToText(): void
  27. {
  28. $this->assertEquals('Test contenu', (new StringsUtils())->convertHtmlToText('<table><tr><td>Test</td></tr></table> <br /><p>contenu</p>'));
  29. }
  30. }