-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPHPUnit8ShimPHPGTE71.php
More file actions
42 lines (37 loc) · 1.15 KB
/
PHPUnit8ShimPHPGTE71.php
File metadata and controls
42 lines (37 loc) · 1.15 KB
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
38
39
40
41
42
<?php
declare(strict_types=1);
namespace Firehed\API\Traits\Testing;
use PHPUnit\Framework\TestCase;
/**
* Create assertIsFoo static methods introduced in PHPUnit 7.5 for users with
* earlier versions
*
* @internal
*/
trait PHPUnit8ShimPHPGTE71
{
public static function assertIsArray($actual, string $message = ''): void
{
if (method_exists(TestCase::class, 'assertIsArray')) {
TestCase::assertIsArray($actual, $message);
} else {
TestCase::assertInternalType('array', $actual, $message);
}
}
public static function assertIsBool($actual, string $message = ''): void
{
if (method_exists(TestCase::class, 'assertIsBool')) {
TestCase::assertIsBool($actual, $message);
} else {
TestCase::assertInternalType('bool', $actual, $message);
}
}
public static function assertIsString($actual, string $message = ''): void
{
if (method_exists(TestCase::class, 'assertIsString')) {
TestCase::assertIsString($actual, $message);
} else {
TestCase::assertInternalType('string', $actual, $message);
}
}
}