-
Notifications
You must be signed in to change notification settings - Fork 8
/
StringHelperTest.php
37 lines (32 loc) · 1.03 KB
/
StringHelperTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace App\Tests\Unit\Helper;
use App\Helper\StringHelper;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\String\Slugger\AsciiSlugger;
/**
* Delete this test if you want to verify that the coverage checker script works
* properly.
*/
#[CoversClass(StringHelper::class)]
final class StringHelperTest extends TestCase
{
/**
* @return iterable<array{0: string|null, 1: string}>
*/
public static function provideSlugify(): iterable
{
yield ['', ''];
yield [null, ''];
yield [' Symfony IS GreAT ! !!', 'symfony-is-great'];
yield ["MicroSymfony 🎶 by COil 🙂👻 \u{a0} ", 'microsymfony-by-coil'];
}
#[DataProvider('provideSlugify')]
public function testSlugify(?string $input, string $expected): void
{
$stringHelper = new StringHelper(new AsciiSlugger());
self::assertSame($expected, $stringHelper->slugify($input));
}
}