|',
Excerpts::processImageHtml('
', $this->page)
);
- $this->assertRegexp(
+ self::assertRegexp(
'|
|',
Excerpts::processImageHtml('
', $this->page)
);
}
- public function testNoProcess()
+ public function testNoProcess(): void
{
- $this->assertStringStartsWith(
+ self::assertStringStartsWith(
'regular process')
);
- $this->assertStringStartsWith(
+ self::assertStringStartsWith(
'noprocess')
);
- $this->assertStringStartsWith(
+ self::assertStringStartsWith(
'noprocess=id')
);
}
- public function testTarget()
+ public function testTarget(): void
{
- $this->assertStringStartsWith(
+ self::assertStringStartsWith(
'only target')
);
- $this->assertStringStartsWith(
+ self::assertStringStartsWith(
'target and rel')
);
diff --git a/tests/unit/Grav/Common/InflectorTest.php b/tests/unit/Grav/Common/InflectorTest.php
index b0b1d4ad9..1db51a2aa 100644
--- a/tests/unit/Grav/Common/InflectorTest.php
+++ b/tests/unit/Grav/Common/InflectorTest.php
@@ -16,130 +16,130 @@ class InflectorTest extends \Codeception\TestCase\Test
/** @var Inflector $uri */
protected $inflector;
- protected function _before()
+ protected function _before(): void
{
$grav = Fixtures::get('grav');
$this->grav = $grav();
$this->inflector = $this->grav['inflector'];
}
- protected function _after()
+ protected function _after(): void
{
}
- public function testPluralize()
+ public function testPluralize(): void
{
- $this->assertSame('words', $this->inflector->pluralize('word'));
- $this->assertSame('kisses', $this->inflector->pluralize('kiss'));
- $this->assertSame('volcanoes', $this->inflector->pluralize('volcanoe'));
- $this->assertSame('cherries', $this->inflector->pluralize('cherry'));
- $this->assertSame('days', $this->inflector->pluralize('day'));
- $this->assertSame('knives', $this->inflector->pluralize('knife'));
+ self::assertSame('words', $this->inflector->pluralize('word'));
+ self::assertSame('kisses', $this->inflector->pluralize('kiss'));
+ self::assertSame('volcanoes', $this->inflector->pluralize('volcanoe'));
+ self::assertSame('cherries', $this->inflector->pluralize('cherry'));
+ self::assertSame('days', $this->inflector->pluralize('day'));
+ self::assertSame('knives', $this->inflector->pluralize('knife'));
}
- public function testSingularize()
+ public function testSingularize(): void
{
- $this->assertSame('word', $this->inflector->singularize('words'));
- $this->assertSame('kiss', $this->inflector->singularize('kisses'));
- $this->assertSame('volcanoe', $this->inflector->singularize('volcanoe'));
- $this->assertSame('cherry', $this->inflector->singularize('cherries'));
- $this->assertSame('day', $this->inflector->singularize('days'));
- $this->assertSame('knife', $this->inflector->singularize('knives'));
+ self::assertSame('word', $this->inflector->singularize('words'));
+ self::assertSame('kiss', $this->inflector->singularize('kisses'));
+ self::assertSame('volcanoe', $this->inflector->singularize('volcanoe'));
+ self::assertSame('cherry', $this->inflector->singularize('cherries'));
+ self::assertSame('day', $this->inflector->singularize('days'));
+ self::assertSame('knife', $this->inflector->singularize('knives'));
}
- public function testTitleize()
+ public function testTitleize(): void
{
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('ThisStringIsTitleized'));
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('this string is titleized'));
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('this_string_is_titleized'));
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('this-string-is-titleized'));
+ self::assertSame('This String Is Titleized', $this->inflector->titleize('ThisStringIsTitleized'));
+ self::assertSame('This String Is Titleized', $this->inflector->titleize('this string is titleized'));
+ self::assertSame('This String Is Titleized', $this->inflector->titleize('this_string_is_titleized'));
+ self::assertSame('This String Is Titleized', $this->inflector->titleize('this-string-is-titleized'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('ThisStringIsTitleized', 'first'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('this string is titleized', 'first'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('this_string_is_titleized', 'first'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('this-string-is-titleized', 'first'));
+ self::assertSame('This string is titleized', $this->inflector->titleize('ThisStringIsTitleized', 'first'));
+ self::assertSame('This string is titleized', $this->inflector->titleize('this string is titleized', 'first'));
+ self::assertSame('This string is titleized', $this->inflector->titleize('this_string_is_titleized', 'first'));
+ self::assertSame('This string is titleized', $this->inflector->titleize('this-string-is-titleized', 'first'));
}
- public function testCamelize()
+ public function testCamelize(): void
{
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('This String Is Camelized'));
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('thisStringIsCamelized'));
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('This_String_Is_Camelized'));
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('this string is camelized'));
- $this->assertSame('GravSPrettyCoolMy1', $this->inflector->camelize("Grav's Pretty Cool. My #1!"));
+ self::assertSame('ThisStringIsCamelized', $this->inflector->camelize('This String Is Camelized'));
+ self::assertSame('ThisStringIsCamelized', $this->inflector->camelize('thisStringIsCamelized'));
+ self::assertSame('ThisStringIsCamelized', $this->inflector->camelize('This_String_Is_Camelized'));
+ self::assertSame('ThisStringIsCamelized', $this->inflector->camelize('this string is camelized'));
+ self::assertSame('GravSPrettyCoolMy1', $this->inflector->camelize("Grav's Pretty Cool. My #1!"));
}
- public function testUnderscorize()
+ public function testUnderscorize(): void
{
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This String Is Underscorized'));
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('ThisStringIsUnderscorized'));
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This_String_Is_Underscorized'));
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This-String-Is-Underscorized'));
+ self::assertSame('this_string_is_underscorized', $this->inflector->underscorize('This String Is Underscorized'));
+ self::assertSame('this_string_is_underscorized', $this->inflector->underscorize('ThisStringIsUnderscorized'));
+ self::assertSame('this_string_is_underscorized', $this->inflector->underscorize('This_String_Is_Underscorized'));
+ self::assertSame('this_string_is_underscorized', $this->inflector->underscorize('This-String-Is-Underscorized'));
}
- public function testHyphenize()
+ public function testHyphenize(): void
{
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This String Is Hyphenized'));
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('ThisStringIsHyphenized'));
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This-String-Is-Hyphenized'));
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This_String_Is_Hyphenized'));
+ self::assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This String Is Hyphenized'));
+ self::assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('ThisStringIsHyphenized'));
+ self::assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This-String-Is-Hyphenized'));
+ self::assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This_String_Is_Hyphenized'));
}
- public function testHumanize()
+ public function testHumanize(): void
{
- //$this->assertSame('This string is humanized', $this->inflector->humanize('ThisStringIsHumanized'));
- $this->assertSame('This string is humanized', $this->inflector->humanize('this_string_is_humanized'));
- //$this->assertSame('This string is humanized', $this->inflector->humanize('this-string-is-humanized'));
+ //self::assertSame('This string is humanized', $this->inflector->humanize('ThisStringIsHumanized'));
+ self::assertSame('This string is humanized', $this->inflector->humanize('this_string_is_humanized'));
+ //self::assertSame('This string is humanized', $this->inflector->humanize('this-string-is-humanized'));
- $this->assertSame('This String Is Humanized', $this->inflector->humanize('this_string_is_humanized', 'all'));
- //$this->assertSame('This String Is Humanized', $this->inflector->humanize('this-string-is-humanized'), 'all');
+ self::assertSame('This String Is Humanized', $this->inflector->humanize('this_string_is_humanized', 'all'));
+ //self::assertSame('This String Is Humanized', $this->inflector->humanize('this-string-is-humanized'), 'all');
}
- public function testVariablize()
+ public function testVariablize(): void
{
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('This String Is Variablized'));
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('ThisStringIsVariablized'));
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('This_String_Is_Variablized'));
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('this string is variablized'));
- $this->assertSame('gravSPrettyCoolMy1', $this->inflector->variablize("Grav's Pretty Cool. My #1!"));
+ self::assertSame('thisStringIsVariablized', $this->inflector->variablize('This String Is Variablized'));
+ self::assertSame('thisStringIsVariablized', $this->inflector->variablize('ThisStringIsVariablized'));
+ self::assertSame('thisStringIsVariablized', $this->inflector->variablize('This_String_Is_Variablized'));
+ self::assertSame('thisStringIsVariablized', $this->inflector->variablize('this string is variablized'));
+ self::assertSame('gravSPrettyCoolMy1', $this->inflector->variablize("Grav's Pretty Cool. My #1!"));
}
- public function testTableize()
+ public function testTableize(): void
{
- $this->assertSame('people', $this->inflector->tableize('Person'));
- $this->assertSame('pages', $this->inflector->tableize('Page'));
- $this->assertSame('blog_pages', $this->inflector->tableize('BlogPage'));
- $this->assertSame('admin_dependencies', $this->inflector->tableize('adminDependency'));
- $this->assertSame('admin_dependencies', $this->inflector->tableize('admin-dependency'));
- $this->assertSame('admin_dependencies', $this->inflector->tableize('admin_dependency'));
+ self::assertSame('people', $this->inflector->tableize('Person'));
+ self::assertSame('pages', $this->inflector->tableize('Page'));
+ self::assertSame('blog_pages', $this->inflector->tableize('BlogPage'));
+ self::assertSame('admin_dependencies', $this->inflector->tableize('adminDependency'));
+ self::assertSame('admin_dependencies', $this->inflector->tableize('admin-dependency'));
+ self::assertSame('admin_dependencies', $this->inflector->tableize('admin_dependency'));
}
- public function testClassify()
+ public function testClassify(): void
{
- $this->assertSame('Person', $this->inflector->classify('people'));
- $this->assertSame('Page', $this->inflector->classify('pages'));
- $this->assertSame('BlogPage', $this->inflector->classify('blog_pages'));
- $this->assertSame('AdminDependency', $this->inflector->classify('admin_dependencies'));
+ self::assertSame('Person', $this->inflector->classify('people'));
+ self::assertSame('Page', $this->inflector->classify('pages'));
+ self::assertSame('BlogPage', $this->inflector->classify('blog_pages'));
+ self::assertSame('AdminDependency', $this->inflector->classify('admin_dependencies'));
}
- public function testOrdinalize()
+ public function testOrdinalize(): void
{
- $this->assertSame('1st', $this->inflector->ordinalize(1));
- $this->assertSame('2nd', $this->inflector->ordinalize(2));
- $this->assertSame('3rd', $this->inflector->ordinalize(3));
- $this->assertSame('4th', $this->inflector->ordinalize(4));
- $this->assertSame('5th', $this->inflector->ordinalize(5));
- $this->assertSame('16th', $this->inflector->ordinalize(16));
- $this->assertSame('51st', $this->inflector->ordinalize(51));
- $this->assertSame('111th', $this->inflector->ordinalize(111));
- $this->assertSame('123rd', $this->inflector->ordinalize(123));
+ self::assertSame('1st', $this->inflector->ordinalize(1));
+ self::assertSame('2nd', $this->inflector->ordinalize(2));
+ self::assertSame('3rd', $this->inflector->ordinalize(3));
+ self::assertSame('4th', $this->inflector->ordinalize(4));
+ self::assertSame('5th', $this->inflector->ordinalize(5));
+ self::assertSame('16th', $this->inflector->ordinalize(16));
+ self::assertSame('51st', $this->inflector->ordinalize(51));
+ self::assertSame('111th', $this->inflector->ordinalize(111));
+ self::assertSame('123rd', $this->inflector->ordinalize(123));
}
- public function testMonthize()
+ public function testMonthize(): void
{
- $this->assertSame(0, $this->inflector->monthize(10));
- $this->assertSame(1, $this->inflector->monthize(33));
- $this->assertSame(1, $this->inflector->monthize(41));
- $this->assertSame(11, $this->inflector->monthize(364));
+ self::assertSame(0, $this->inflector->monthize(10));
+ self::assertSame(1, $this->inflector->monthize(33));
+ self::assertSame(1, $this->inflector->monthize(41));
+ self::assertSame(11, $this->inflector->monthize(364));
}
}
diff --git a/tests/unit/Grav/Common/Language/LanguageCodesTest.php b/tests/unit/Grav/Common/Language/LanguageCodesTest.php
index 3fbc69eb0..3450c88ea 100644
--- a/tests/unit/Grav/Common/Language/LanguageCodesTest.php
+++ b/tests/unit/Grav/Common/Language/LanguageCodesTest.php
@@ -7,21 +7,21 @@ use Grav\Common\Language\LanguageCodes;
*/
class LanguageCodesTest extends \Codeception\TestCase\Test
{
- public function testRtl()
+ public function testRtl(): void
{
- $this->assertSame(
+ self::assertSame(
'ltr',
LanguageCodes::getOrientation('en')
);
- $this->assertSame(
+ self::assertSame(
'rtl',
LanguageCodes::getOrientation('ar')
);
- $this->assertSame(
+ self::assertSame(
'rtl',
LanguageCodes::getOrientation('he')
);
- $this->assertTrue(LanguageCodes::isRtl('ar'));
- $this->assertFalse(LanguageCodes::isRtl('fr'));
+ self::assertTrue(LanguageCodes::isRtl('ar'));
+ self::assertFalse(LanguageCodes::isRtl('fr'));
}
}
diff --git a/tests/unit/Grav/Common/Markdown/ParsedownTest.php b/tests/unit/Grav/Common/Markdown/ParsedownTest.php
index 451190965..2547a0eae 100644
--- a/tests/unit/Grav/Common/Markdown/ParsedownTest.php
+++ b/tests/unit/Grav/Common/Markdown/ParsedownTest.php
@@ -35,7 +35,7 @@ class ParsedownTest extends \Codeception\TestCase\Test
protected $old_home;
- protected function _before()
+ protected function _before(): void
{
$grav = Fixtures::get('grav');
$this->grav = $grav();
@@ -72,176 +72,176 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->parsedown = new Parsedown($excerpts);
}
- protected function _after()
+ protected function _after(): void
{
$this->config->set('system.home.alias', $this->old_home);
}
- public function testImages()
+ public function testImages(): void
{
$this->config->set('system.languages.supported', ['fr','en']);
unset($this->grav['language']);
$this->grav['language'] = new Language($this->grav);
$this->uri->initializeWithURL('http://testing.dev/fr/item2/item2-2')->init();
- $this->assertSame(
+ self::assertSame(
'
<\/p>|',
$this->parsedown->text('')
);
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame(
+ self::assertSame(
'

<\/p>|',
$this->parsedown->text('')
);
- $this->assertRegexp(
+ self::assertRegexp(
'|
<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'



<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'

<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'



<\/p>|',
$this->parsedown->text('')
);
- $this->assertRegexp(
+ self::assertRegexp(
'|
<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'



<\/p>|',
$this->parsedown->text('')
);
- $this->assertRegexp(
+ self::assertRegexp(
'|
<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'










<\/p>|',
$this->parsedown->text('')
);
- $this->assertRegexp(
+ self::assertRegexp(
'|
<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'



<\/p>|',
$this->parsedown->text('')
);
- $this->assertRegexp(
+ self::assertRegexp(
'|
<\/p>|',
$this->parsedown->text('')
);
- $this->assertSame(
+ self::assertSame(
'


this is my text
', '(<\/?p>)', '') ); - $this->assertSame( + self::assertSame( 'this is my text', $this->twig_ext->regexReplace('this is my text
', ['()','(<\/p>)'], ['','']) ); } - public function testArrayKeyValue() + public function testArrayKeyValue(): void { - $this->assertSame( + self::assertSame( ['meat' => 'steak'], $this->twig_ext->arrayKeyValueFunc('meat', 'steak') ); - $this->assertSame( + self::assertSame( ['fruit' => 'apple', 'meat' => 'steak'], $this->twig_ext->arrayKeyValueFunc('meat', 'steak', ['fruit' => 'apple']) ); } - public function stringFunc() + public function stringFunc(): void { } - public function testRangeFunc() + public function testRangeFunc(): void { $hundred = []; for ($i = 0; $i <= 100; $i++) { @@ -184,19 +184,19 @@ class TwigExtensionTest extends \Codeception\TestCase\Test } - $this->assertSame([0], $this->twig_ext->rangeFunc(0, 0)); - $this->assertSame([0, 1, 2], $this->twig_ext->rangeFunc(0, 2)); + self::assertSame([0], $this->twig_ext->rangeFunc(0, 0)); + self::assertSame([0, 1, 2], $this->twig_ext->rangeFunc(0, 2)); - $this->assertSame([0, 5, 10, 15], $this->twig_ext->rangeFunc(0, 16, 5)); + self::assertSame([0, 5, 10, 15], $this->twig_ext->rangeFunc(0, 16, 5)); // default (min 0, max 100, step 1) - $this->assertSame($hundred, $this->twig_ext->rangeFunc()); + self::assertSame($hundred, $this->twig_ext->rangeFunc()); // 95 items, starting from 5, (min 5, max 100, step 1) - $this->assertSame(array_slice($hundred, 5), $this->twig_ext->rangeFunc(5)); + self::assertSame(array_slice($hundred, 5), $this->twig_ext->rangeFunc(5)); // reversed range - $this->assertSame(array_reverse($hundred), $this->twig_ext->rangeFunc(100, 0)); - $this->assertSame([4, 2, 0], $this->twig_ext->rangeFunc(4, 0, 2)); + self::assertSame(array_reverse($hundred), $this->twig_ext->rangeFunc(100, 0)); + self::assertSame([4, 2, 0], $this->twig_ext->rangeFunc(4, 0, 2)); } } diff --git a/tests/unit/Grav/Common/UriTest.php b/tests/unit/Grav/Common/UriTest.php index cec8eb62c..8f1601a6f 100644 --- a/tests/unit/Grav/Common/UriTest.php +++ b/tests/unit/Grav/Common/UriTest.php @@ -854,18 +854,18 @@ class UriTest extends \Codeception\TestCase\Test ], ]; - protected function _before() + protected function _before(): void { $grav = Fixtures::get('grav'); $this->grav = $grav(); $this->uri = $this->grav['uri']; } - protected function _after() + protected function _after(): void { } - protected function runTestSet(array $tests, $method, $params = []) + protected function runTestSet(array $tests, $method, $params = []): void { foreach ($tests as $url => $candidates) { if (!array_key_exists($method, $candidates) && $method !== 'toOriginalString') { @@ -875,7 +875,7 @@ class UriTest extends \Codeception\TestCase\Test $nonce = Utils::getNonce('test-action'); $expected = str_replace('{{nonce}}', $nonce, $candidates[$method]); - $this->assertSame($expected, Uri::addNonce($url, 'test-action')); + self::assertSame($expected, Uri::addNonce($url, 'test-action')); continue; } @@ -893,213 +893,213 @@ class UriTest extends \Codeception\TestCase\Test $result = $this->uri->{$method}(); } - $this->assertSame($expected, $result, "Test \$url->{$method}() for {$url}"); + self::assertSame($expected, $result, "Test \$url->{$method}() for {$url}"); // Deal with $url->query($key) if ($method === 'query') { parse_str($expected, $queryParams); foreach ($queryParams as $key => $value) { - $this->assertSame($value, $this->uri->{$method}($key), "Test \$url->{$method}('{$key}') for {$url}"); + self::assertSame($value, $this->uri->{$method}($key), "Test \$url->{$method}('{$key}') for {$url}"); } - $this->assertNull($this->uri->{$method}('non-existing'), "Test \$url->{$method}('non-existing') for {$url}"); + self::assertNull($this->uri->{$method}('non-existing'), "Test \$url->{$method}('non-existing') for {$url}"); } } } - public function testValidatingHostname() + public function testValidatingHostname(): void { - $this->assertTrue($this->uri->validateHostname('localhost')); - $this->assertTrue($this->uri->validateHostname('google.com')); - $this->assertTrue($this->uri->validateHostname('google.it')); - $this->assertTrue($this->uri->validateHostname('goog.le')); - $this->assertTrue($this->uri->validateHostname('goog.wine')); - $this->assertTrue($this->uri->validateHostname('goog.localhost')); + self::assertTrue($this->uri->validateHostname('localhost')); + self::assertTrue($this->uri->validateHostname('google.com')); + self::assertTrue($this->uri->validateHostname('google.it')); + self::assertTrue($this->uri->validateHostname('goog.le')); + self::assertTrue($this->uri->validateHostname('goog.wine')); + self::assertTrue($this->uri->validateHostname('goog.localhost')); - $this->assertFalse($this->uri->validateHostname('localhost:80')); - $this->assertFalse($this->uri->validateHostname('http://localhost')); - $this->assertFalse($this->uri->validateHostname('localhost!')); + self::assertFalse($this->uri->validateHostname('localhost:80')); + self::assertFalse($this->uri->validateHostname('http://localhost')); + self::assertFalse($this->uri->validateHostname('localhost!')); } - public function testToString() + public function testToString(): void { $this->runTestSet($this->tests, 'toOriginalString'); } - public function testScheme() + public function testScheme(): void { $this->runTestSet($this->tests, 'scheme'); } - public function testUser() + public function testUser(): void { $this->runTestSet($this->tests, 'user'); } - public function testPassword() + public function testPassword(): void { $this->runTestSet($this->tests, 'password'); } - public function testHost() + public function testHost(): void { $this->runTestSet($this->tests, 'host'); } - public function testPort() + public function testPort(): void { $this->runTestSet($this->tests, 'port'); } - public function testPath() + public function testPath(): void { $this->runTestSet($this->tests, 'path'); } - public function testQuery() + public function testQuery(): void { $this->runTestSet($this->tests, 'query'); } - public function testFragment() + public function testFragment(): void { $this->runTestSet($this->tests, 'fragment'); $this->uri->fragment('something-new'); - $this->assertSame('something-new', $this->uri->fragment()); + self::assertSame('something-new', $this->uri->fragment()); } - public function testPaths() + public function testPaths(): void { $this->runTestSet($this->tests, 'paths'); } - public function testRoute() + public function testRoute(): void { $this->runTestSet($this->tests, 'route'); } - public function testParams() + public function testParams(): void { $this->runTestSet($this->tests, 'params'); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init(); - $this->assertSame('/ueper:xxx', $this->uri->params('ueper')); + self::assertSame('/ueper:xxx', $this->uri->params('ueper')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init(); - $this->assertSame('/ueper:xxx', $this->uri->params('ueper')); - $this->assertSame('/test:yyy', $this->uri->params('test')); + self::assertSame('/ueper:xxx', $this->uri->params('ueper')); + self::assertSame('/test:yyy', $this->uri->params('test')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yyy')->init(); - $this->assertSame('/ueper:xxx++/test:yyy', $this->uri->params()); - $this->assertSame('/ueper:xxx++', $this->uri->params('ueper')); - $this->assertSame('/test:yyy', $this->uri->params('test')); + self::assertSame('/ueper:xxx++/test:yyy', $this->uri->params()); + self::assertSame('/ueper:xxx++', $this->uri->params('ueper')); + self::assertSame('/test:yyy', $this->uri->params('test')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yyy#something')->init(); - $this->assertSame('/ueper:xxx++/test:yyy', $this->uri->params()); - $this->assertSame('/ueper:xxx++', $this->uri->params('ueper')); - $this->assertSame('/test:yyy', $this->uri->params('test')); + self::assertSame('/ueper:xxx++/test:yyy', $this->uri->params()); + self::assertSame('/ueper:xxx++', $this->uri->params('ueper')); + self::assertSame('/test:yyy', $this->uri->params('test')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yyy?foo=bar')->init(); - $this->assertSame('/ueper:xxx++/test:yyy', $this->uri->params()); - $this->assertSame('/ueper:xxx++', $this->uri->params('ueper')); - $this->assertSame('/test:yyy', $this->uri->params('test')); + self::assertSame('/ueper:xxx++/test:yyy', $this->uri->params()); + self::assertSame('/ueper:xxx++', $this->uri->params('ueper')); + self::assertSame('/test:yyy', $this->uri->params('test')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init(); - $this->assertNull($this->uri->params()); - $this->assertNull($this->uri->params('ueper')); + self::assertNull($this->uri->params()); + self::assertNull($this->uri->params('ueper')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init(); - $this->assertNull($this->uri->params()); - $this->assertNull($this->uri->params('ueper')); + self::assertNull($this->uri->params()); + self::assertNull($this->uri->params('ueper')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init(); - $this->assertNull($this->uri->params()); - $this->assertNull($this->uri->params('ueper')); + self::assertNull($this->uri->params()); + self::assertNull($this->uri->params('ueper')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init(); - $this->assertNull($this->uri->params()); - $this->assertNull($this->uri->params('ueper')); + self::assertNull($this->uri->params()); + self::assertNull($this->uri->params('ueper')); $this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init(); - $this->assertNull($this->uri->params()); - $this->assertNull($this->uri->params('ueper')); + self::assertNull($this->uri->params()); + self::assertNull($this->uri->params('ueper')); $this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init(); - $this->assertNull($this->uri->params()); - $this->assertNull($this->uri->params('ueper')); + self::assertNull($this->uri->params()); + self::assertNull($this->uri->params('ueper')); } - public function testParam() + public function testParam(): void { $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init(); - $this->assertSame('xxx', $this->uri->param('ueper')); + self::assertSame('xxx', $this->uri->param('ueper')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init(); - $this->assertSame('xxx', $this->uri->param('ueper')); - $this->assertSame('yyy', $this->uri->param('test')); + self::assertSame('xxx', $this->uri->param('ueper')); + self::assertSame('yyy', $this->uri->param('test')); $this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx++/test:yy%20y/foo:bar_baz-bank')->init(); - $this->assertSame('xxx++', $this->uri->param('ueper')); - $this->assertSame('yy y', $this->uri->param('test')); - $this->assertSame('bar_baz-bank', $this->uri->param('foo')); + self::assertSame('xxx++', $this->uri->param('ueper')); + self::assertSame('yy y', $this->uri->param('test')); + self::assertSame('bar_baz-bank', $this->uri->param('foo')); } - public function testUrl() + public function testUrl(): void { $this->runTestSet($this->tests, 'url'); } - public function testExtension() + public function testExtension(): void { $this->runTestSet($this->tests, 'extension'); $this->uri->initializeWithURL('http://localhost/a-page')->init(); - $this->assertSame('x', $this->uri->extension('x')); + self::assertSame('x', $this->uri->extension('x')); } - public function testEnvironment() + public function testEnvironment(): void { $this->runTestSet($this->tests, 'environment'); } - public function testBasename() + public function testBasename(): void { $this->runTestSet($this->tests, 'basename'); } - public function testBase() + public function testBase(): void { $this->runTestSet($this->tests, 'base'); } - public function testRootUrl() + public function testRootUrl(): void { $this->runTestSet($this->tests, 'rootUrl', [true]); $this->uri->initializeWithUrlAndRootPath('https://localhost/grav/page-foo', '/grav')->init(); - $this->assertSame('/grav', $this->uri->rootUrl()); - $this->assertSame('https://localhost/grav', $this->uri->rootUrl(true)); + self::assertSame('/grav', $this->uri->rootUrl()); + self::assertSame('https://localhost/grav', $this->uri->rootUrl(true)); } - public function testCurrentPage() + public function testCurrentPage(): void { $this->runTestSet($this->tests, 'currentPage'); $this->uri->initializeWithURL('http://localhost:8080/a-page/page:2')->init(); - $this->assertSame(2, $this->uri->currentPage()); + self::assertSame(2, $this->uri->currentPage()); } - public function testReferrer() + public function testReferrer(): void { $this->uri->initializeWithURL('http://localhost/foo/page:test')->init(); - $this->assertSame('/foo', $this->uri->referrer()); + self::assertSame('/foo', $this->uri->referrer()); $this->uri->initializeWithURL('http://localhost/foo/bar/page:test')->init(); - $this->assertSame('/foo/bar', $this->uri->referrer()); + self::assertSame('/foo/bar', $this->uri->referrer()); } - public function testIp() + public function testIp(): void { $this->uri->initializeWithURL('http://localhost/foo/page:test')->init(); - $this->assertSame('UNKNOWN', Uri::ip()); + self::assertSame('UNKNOWN', Uri::ip()); } - public function testIsExternal() + public function testIsExternal(): void { $this->uri->initializeWithURL('http://localhost/')->init(); - $this->assertFalse(Uri::isExternal('/test')); - $this->assertFalse(Uri::isExternal('/foo/bar')); - $this->assertTrue(Uri::isExternal('http://localhost/test')); - $this->assertTrue(Uri::isExternal('http://google.it/test')); + self::assertFalse(Uri::isExternal('/test')); + self::assertFalse(Uri::isExternal('/foo/bar')); + self::assertTrue(Uri::isExternal('http://localhost/test')); + self::assertTrue(Uri::isExternal('http://google.it/test')); } - public function testBuildUrl() + public function testBuildUrl(): void { $parsed_url = [ 'scheme' => 'http', @@ -1107,7 +1107,7 @@ class UriTest extends \Codeception\TestCase\Test 'port' => 8080, ]; - $this->assertSame('http://localhost:8080', Uri::buildUrl($parsed_url)); + self::assertSame('http://localhost:8080', Uri::buildUrl($parsed_url)); $parsed_url = [ 'scheme' => 'http', @@ -1120,32 +1120,32 @@ class UriTest extends \Codeception\TestCase\Test 'fragment' => 'xxx', ]; - $this->assertSame('http://foo:bar@localhost:8080/test?x=2#xxx', Uri::buildUrl($parsed_url)); + self::assertSame('http://foo:bar@localhost:8080/test?x=2#xxx', Uri::buildUrl($parsed_url)); /** @var Uri $uri */ $uri = Grav::instance()['uri']; $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html', '/subdir')->init(); - $this->assertSame('https://testing.dev/subdir/path1/path2/file.html', Uri::buildUrl($uri->toArray(true))); + self::assertSame('https://testing.dev/subdir/path1/path2/file.html', Uri::buildUrl($uri->toArray(true))); $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.foo', '/subdir')->init(); - $this->assertSame('https://testing.dev/subdir/path1/path2/file.foo', Uri::buildUrl($uri->toArray(true))); + self::assertSame('https://testing.dev/subdir/path1/path2/file.foo', Uri::buildUrl($uri->toArray(true))); $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html', '/subdir/path1')->init(); - $this->assertSame('https://testing.dev/subdir/path1/path2/file.html', Uri::buildUrl($uri->toArray(true))); + self::assertSame('https://testing.dev/subdir/path1/path2/file.html', Uri::buildUrl($uri->toArray(true))); $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom', '/subdir')->init(); - $this->assertSame('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom', Uri::buildUrl($uri->toArray(true))); + self::assertSame('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom', Uri::buildUrl($uri->toArray(true))); $uri->initializeWithUrlAndRootPath('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom?fig=something', '/subdir')->init(); - $this->assertSame('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom?fig=something', Uri::buildUrl($uri->toArray(true))); + self::assertSame('https://testing.dev/subdir/path1/path2/file.html/foo:blah/bang:boom?fig=something', Uri::buildUrl($uri->toArray(true))); } - public function testConvertUrl() + public function testConvertUrl(): void { } - public function testAddNonce() + public function testAddNonce(): void { $this->runTestSet($this->tests, 'addNonce'); } diff --git a/tests/unit/Grav/Common/UtilsTest.php b/tests/unit/Grav/Common/UtilsTest.php index d27cdf64b..4329a454e 100644 --- a/tests/unit/Grav/Common/UtilsTest.php +++ b/tests/unit/Grav/Common/UtilsTest.php @@ -16,113 +16,113 @@ class UtilsTest extends \Codeception\TestCase\Test /** @var Uri $uri */ protected $uri; - protected function _before() + protected function _before(): void { $grav = Fixtures::get('grav'); $this->grav = $grav(); $this->uri = $this->grav['uri']; } - protected function _after() + protected function _after(): void { } - public function testStartsWith() + public function testStartsWith(): void { - $this->assertTrue(Utils::startsWith('english', 'en')); - $this->assertTrue(Utils::startsWith('English', 'En')); - $this->assertTrue(Utils::startsWith('ENGLISH', 'EN')); - $this->assertTrue(Utils::startsWith( + self::assertTrue(Utils::startsWith('english', 'en')); + self::assertTrue(Utils::startsWith('English', 'En')); + self::assertTrue(Utils::startsWith('ENGLISH', 'EN')); + self::assertTrue(Utils::startsWith( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'EN' )); - $this->assertFalse(Utils::startsWith('english', 'En')); - $this->assertFalse(Utils::startsWith('English', 'EN')); - $this->assertFalse(Utils::startsWith('ENGLISH', 'en')); - $this->assertFalse(Utils::startsWith( + self::assertFalse(Utils::startsWith('english', 'En')); + self::assertFalse(Utils::startsWith('English', 'EN')); + self::assertFalse(Utils::startsWith('ENGLISH', 'en')); + self::assertFalse(Utils::startsWith( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'e' )); - $this->assertTrue(Utils::startsWith('english', 'En', false)); - $this->assertTrue(Utils::startsWith('English', 'EN', false)); - $this->assertTrue(Utils::startsWith('ENGLISH', 'en', false)); - $this->assertTrue(Utils::startsWith( + self::assertTrue(Utils::startsWith('english', 'En', false)); + self::assertTrue(Utils::startsWith('English', 'EN', false)); + self::assertTrue(Utils::startsWith('ENGLISH', 'en', false)); + self::assertTrue(Utils::startsWith( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'e', false )); } - public function testEndsWith() + public function testEndsWith(): void { - $this->assertTrue(Utils::endsWith('english', 'sh')); - $this->assertTrue(Utils::endsWith('EngliSh', 'Sh')); - $this->assertTrue(Utils::endsWith('ENGLISH', 'SH')); - $this->assertTrue(Utils::endsWith( + self::assertTrue(Utils::endsWith('english', 'sh')); + self::assertTrue(Utils::endsWith('EngliSh', 'Sh')); + self::assertTrue(Utils::endsWith('ENGLISH', 'SH')); + self::assertTrue(Utils::endsWith( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'ENGLISH' )); - $this->assertFalse(Utils::endsWith('english', 'de')); - $this->assertFalse(Utils::endsWith('EngliSh', 'sh')); - $this->assertFalse(Utils::endsWith('ENGLISH', 'Sh')); - $this->assertFalse(Utils::endsWith( + self::assertFalse(Utils::endsWith('english', 'de')); + self::assertFalse(Utils::endsWith('EngliSh', 'sh')); + self::assertFalse(Utils::endsWith('ENGLISH', 'Sh')); + self::assertFalse(Utils::endsWith( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'DEUSTCH' )); - $this->assertTrue(Utils::endsWith('english', 'SH', false)); - $this->assertTrue(Utils::endsWith('EngliSh', 'sH', false)); - $this->assertTrue(Utils::endsWith('ENGLISH', 'sh', false)); - $this->assertTrue(Utils::endsWith( + self::assertTrue(Utils::endsWith('english', 'SH', false)); + self::assertTrue(Utils::endsWith('EngliSh', 'sH', false)); + self::assertTrue(Utils::endsWith('ENGLISH', 'sh', false)); + self::assertTrue(Utils::endsWith( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'english', false )); } - public function testContains() + public function testContains(): void { - $this->assertTrue(Utils::contains('english', 'nglis')); - $this->assertTrue(Utils::contains('EngliSh', 'gliSh')); - $this->assertTrue(Utils::contains('ENGLISH', 'ENGLI')); - $this->assertTrue(Utils::contains( + self::assertTrue(Utils::contains('english', 'nglis')); + self::assertTrue(Utils::contains('EngliSh', 'gliSh')); + self::assertTrue(Utils::contains('ENGLISH', 'ENGLI')); + self::assertTrue(Utils::contains( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'ENGLISH' )); - $this->assertFalse(Utils::contains('EngliSh', 'GLI')); - $this->assertFalse(Utils::contains('EngliSh', 'English')); - $this->assertFalse(Utils::contains('ENGLISH', 'SCH')); - $this->assertFalse(Utils::contains( + self::assertFalse(Utils::contains('EngliSh', 'GLI')); + self::assertFalse(Utils::contains('EngliSh', 'English')); + self::assertFalse(Utils::contains('ENGLISH', 'SCH')); + self::assertFalse(Utils::contains( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'DEUSTCH' )); - $this->assertTrue(Utils::contains('EngliSh', 'GLI', false)); - $this->assertTrue(Utils::contains('EngliSh', 'ENGLISH', false)); - $this->assertTrue(Utils::contains('ENGLISH', 'ish', false)); - $this->assertTrue(Utils::contains( + self::assertTrue(Utils::contains('EngliSh', 'GLI', false)); + self::assertTrue(Utils::contains('EngliSh', 'ENGLISH', false)); + self::assertTrue(Utils::contains('ENGLISH', 'ish', false)); + self::assertTrue(Utils::contains( 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'english', false )); } - public function testSubstrToString() + public function testSubstrToString(): void { - $this->assertEquals('en', Utils::substrToString('english', 'glish')); - $this->assertEquals('english', Utils::substrToString('english', 'test')); - $this->assertNotEquals('en', Utils::substrToString('english', 'lish')); + self::assertEquals('en', Utils::substrToString('english', 'glish')); + self::assertEquals('english', Utils::substrToString('english', 'test')); + self::assertNotEquals('en', Utils::substrToString('english', 'lish')); - $this->assertEquals('en', Utils::substrToString('english', 'GLISH', false)); - $this->assertEquals('english', Utils::substrToString('english', 'TEST', false)); - $this->assertNotEquals('en', Utils::substrToString('english', 'LISH', false)); + self::assertEquals('en', Utils::substrToString('english', 'GLISH', false)); + self::assertEquals('english', Utils::substrToString('english', 'TEST', false)); + self::assertNotEquals('en', Utils::substrToString('english', 'LISH', false)); } - public function testMergeObjects() + public function testMergeObjects(): void { $obj1 = new stdClass(); $obj1->test1 = 'x'; @@ -131,150 +131,150 @@ class UtilsTest extends \Codeception\TestCase\Test $objMerged = Utils::mergeObjects($obj1, $obj2); - $this->assertObjectHasAttribute('test1', $objMerged); - $this->assertObjectHasAttribute('test2', $objMerged); + self::assertObjectHasAttribute('test1', $objMerged); + self::assertObjectHasAttribute('test2', $objMerged); } - public function testDateFormats() + public function testDateFormats(): void { $dateFormats = Utils::dateFormats(); - $this->assertIsArray($dateFormats); - $this->assertContainsOnly('string', $dateFormats); + self::assertIsArray($dateFormats); + self::assertContainsOnly('string', $dateFormats); $default_format = $this->grav['config']->get('system.pages.dateformat.default'); if ($default_format !== null) { - $this->assertArrayHasKey($default_format, $dateFormats); + self::assertArrayHasKey($default_format, $dateFormats); } } - public function testTruncate() + public function testTruncate(): void { - $this->assertEquals('engli' . '…', Utils::truncate('english', 5)); - $this->assertEquals('english', Utils::truncate('english')); - $this->assertEquals('This is a string to truncate', Utils::truncate('This is a string to truncate')); - $this->assertEquals('Th' . '…', Utils::truncate('This is a string to truncate', 2)); - $this->assertEquals('engli' . '...', Utils::truncate('english', 5, true, " ", "...")); - $this->assertEquals('english', Utils::truncate('english')); - $this->assertEquals('This is a string to truncate', Utils::truncate('This is a string to truncate')); - $this->assertEquals('This' . '…', Utils::truncate('This is a string to truncate', 3, true)); - $this->assertEquals('', 6, true)); + self::assertEquals('engli' . '…', Utils::truncate('english', 5)); + self::assertEquals('english', Utils::truncate('english')); + self::assertEquals('This is a string to truncate', Utils::truncate('This is a string to truncate')); + self::assertEquals('Th' . '…', Utils::truncate('This is a string to truncate', 2)); + self::assertEquals('engli' . '...', Utils::truncate('english', 5, true, " ", "...")); + self::assertEquals('english', Utils::truncate('english')); + self::assertEquals('This is a string to truncate', Utils::truncate('This is a string to truncate')); + self::assertEquals('This' . '…', Utils::truncate('This is a string to truncate', 3, true)); + self::assertEquals('', 6, true)); } - public function testSafeTruncate() + public function testSafeTruncate(): void { - $this->assertEquals('This' . '…', Utils::safeTruncate('This is a string to truncate', 1)); - $this->assertEquals('This' . '…', Utils::safeTruncate('This is a string to truncate', 4)); - $this->assertEquals('This is' . '…', Utils::safeTruncate('This is a string to truncate', 5)); + self::assertEquals('This' . '…', Utils::safeTruncate('This is a string to truncate', 1)); + self::assertEquals('This' . '…', Utils::safeTruncate('This is a string to truncate', 4)); + self::assertEquals('This is' . '…', Utils::safeTruncate('This is a string to truncate', 5)); } - public function testTruncateHtml() + public function testTruncateHtml(): void { - $this->assertEquals('T...', Utils::truncateHtml('This is a string to truncate', 1)); - $this->assertEquals('This is...', Utils::truncateHtml('This is a string to truncate', 7)); - $this->assertEquals('
T...
', Utils::truncateHtml('This is a string to truncate
', 1)); - $this->assertEquals('This...
', Utils::truncateHtml('This is a string to truncate
', 4)); - $this->assertEquals('This is a...
', Utils::truncateHtml('This is a string to truncate
', 10)); - $this->assertEquals('This is a string to truncate
', Utils::truncateHtml('This is a string to truncate
', 100)); - $this->assertEquals('', Utils::truncateHtml('', 6)); - $this->assertEquals('This is a string.
\nIt splits two lines.
", Utils::truncateHtml("This is a string.
\nIt splits two lines.
", 100)); + self::assertEquals('T...', Utils::truncateHtml('This is a string to truncate', 1)); + self::assertEquals('This is...', Utils::truncateHtml('This is a string to truncate', 7)); + self::assertEquals('T...
', Utils::truncateHtml('This is a string to truncate
', 1)); + self::assertEquals('This...
', Utils::truncateHtml('This is a string to truncate
', 4)); + self::assertEquals('This is a...
', Utils::truncateHtml('This is a string to truncate
', 10)); + self::assertEquals('This is a string to truncate
', Utils::truncateHtml('This is a string to truncate
', 100)); + self::assertEquals('', Utils::truncateHtml('', 6)); + self::assertEquals('This is a string.
\nIt splits two lines.
", Utils::truncateHtml("This is a string.
\nIt splits two lines.
", 100)); } - public function testSafeTruncateHtml() + public function testSafeTruncateHtml(): void { - $this->assertEquals('This...', Utils::safeTruncateHtml('This is a string to truncate', 1)); - $this->assertEquals('This is a...', Utils::safeTruncateHtml('This is a string to truncate', 3)); - $this->assertEquals('This...
', Utils::safeTruncateHtml('This is a string to truncate
', 1)); - $this->assertEquals('This is...
', Utils::safeTruncateHtml('This is a string to truncate
', 2)); - $this->assertEquals('This is a string to...
', Utils::safeTruncateHtml('This is a string to truncate
', 5)); - $this->assertEquals('This is a string to truncate
', Utils::safeTruncateHtml('This is a string to truncate
', 20)); - $this->assertEquals('', Utils::safeTruncateHtml('', 6)); - $this->assertEquals('This...
', Utils::safeTruncateHtml('This is a string to truncate
', 1)); + self::assertEquals('This is...
', Utils::safeTruncateHtml('This is a string to truncate
', 2)); + self::assertEquals('This is a string to...
', Utils::safeTruncateHtml('This is a string to truncate
', 5)); + self::assertEquals('This is a string to truncate
', Utils::safeTruncateHtml('This is a string to truncate
', 20)); + self::assertEquals('', Utils::safeTruncateHtml('', 6)); + self::assertEquals('