-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psl\Tests\Type; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Psl\Math; | ||
use Psl\Type; | ||
|
||
final class IsBoolTest extends TestCase | ||
{ | ||
public function testIsBool(): void | ||
{ | ||
static::assertTrue(Type\is_bool(true)); | ||
|
||
static::assertFalse(Type\is_bool(123)); | ||
static::assertFalse(Type\is_bool(0)); | ||
static::assertFalse(Type\is_bool(Math\INT16_MAX)); | ||
static::assertFalse(Type\is_bool('5')); | ||
static::assertFalse(Type\is_bool(null)); | ||
static::assertFalse(Type\is_bool(5.0)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psl\Tests\Type; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Psl\Math; | ||
use Psl\Type; | ||
|
||
final class IsFloatTest extends TestCase | ||
{ | ||
public function testIsFloat(): void | ||
{ | ||
static::assertTrue(Type\is_float(5.0)); | ||
|
||
static::assertFalse(Type\is_float(123)); | ||
static::assertFalse(Type\is_float(0)); | ||
static::assertFalse(Type\is_float(Math\INT16_MAX)); | ||
static::assertFalse(Type\is_float('5')); | ||
static::assertFalse(Type\is_float(true)); | ||
static::assertFalse(Type\is_float(null)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psl\Tests\Type; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Psl\Math; | ||
use Psl\Type; | ||
|
||
final class IsNullTest extends TestCase | ||
{ | ||
public function testIsNull(): void | ||
{ | ||
static::assertTrue(Type\is_null(null)); | ||
|
||
static::assertFalse(Type\is_null(123)); | ||
static::assertFalse(Type\is_null(0)); | ||
static::assertFalse(Type\is_null(Math\INT16_MAX)); | ||
static::assertFalse(Type\is_null('5')); | ||
static::assertFalse(Type\is_null(true)); | ||
static::assertFalse(Type\is_null(5.0)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psl\Tests\Type; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Psl\Math; | ||
use Psl\Type; | ||
|
||
use const STDOUT; | ||
|
||
final class IsResourceTest extends TestCase | ||
{ | ||
public function testIsResource(): void | ||
{ | ||
static::assertTrue(Type\is_resource(STDOUT)); | ||
|
||
static::assertFalse(Type\is_resource(null)); | ||
static::assertFalse(Type\is_resource(123)); | ||
static::assertFalse(Type\is_resource(0)); | ||
static::assertFalse(Type\is_resource(Math\INT16_MAX)); | ||
static::assertFalse(Type\is_resource('5')); | ||
static::assertFalse(Type\is_resource(true)); | ||
static::assertFalse(Type\is_resource(5.0)); | ||
} | ||
} |