endtoend-test-psl/tests/Psl/Str/IsStringTest.php

31 lines
700 B
PHP
Raw Normal View History

2019-12-24 01:52:07 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Str;
use PHPUnit\Framework\TestCase;
2019-12-26 23:10:57 +01:00
use Psl\Str;
2019-12-24 01:52:07 +01:00
class IsStringTest extends TestCase
{
2019-12-26 23:10:57 +01:00
public function testIsEmpty(): void
{
self::assertTrue(Str\is_string(''));
self::assertTrue(Str\is_string(Str\chr(0)));
self::assertFalse(Str\is_string(5));
self::assertFalse(Str\is_string(5.0));
self::assertFalse(Str\is_string(true));
self::assertFalse(Str\is_string(null));
self::assertFalse(Str\is_string(
new class {
public function __toString(): string
{
return 'hello';
}
}
));
}
2019-12-24 01:52:07 +01:00
}