[lang-ref] ( string_is_empty ) ( php )
<?php
#[DataProvider('dataProviderStringIsEmpty')]
public function testStringIsEmpty(string $s, bool $expected): void
{
// $s === ''
$is_empty = ($s === '');
$this->assertSame($expected, $is_empty);
$is_empty = (strlen($s) === 0);
$this->assertSame($expected, $is_empty);
}
public static function dataProviderStringIsEmpty(): array
{
return [
"''" => ['', true],
"' '" => [' ', false],
"'a'" => ['a', false],
];
}