Completed
Pull Request — main (#164)
by Christian
10:40
created

MyTestCase::assertInternalType()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.2888
c 0
b 0
f 0
cc 5
nc 5
nop 3
1
<?php
2
3
/*
4
 * OpenWeatherMap-PHP-API — A PHP API to parse weather data from https://OpenWeatherMap.org.
5
 *
6
 * @license MIT
7
 *
8
 * Please see the LICENSE file distributed with this source code for further
9
 * information regarding copyright and licensing.
10
 *
11
 * Please visit the following links to read about the usage policies and the license of
12
 * OpenWeatherMap data before using this library:
13
 *
14
 * @see https://OpenWeatherMap.org/price
15
 * @see https://OpenWeatherMap.org/terms
16
 * @see https://OpenWeatherMap.org/appid
17
 */
18
19
namespace Cmfcmf\OpenWeatherMap\Tests;
20
21
22
abstract class MyTestCase extends \PHPUnit\Framework\TestCase
23
{
24
    public static function assertInternalType(string $expected, $actual, string $message = ''): void
25
    {
26
      if (version_compare(phpversion(), '7.2', '>=')) {
27
          switch ($expected) {
28
            case 'string':
29
                static::assertIsString($actual);
30
                break;
31
            case 'object':
32
                static::assertIsObject($actual);
33
                break;
34
            case 'float':
35
                static::assertIsFloat($actual);
36
                break;
37
            default:
38
                throw new Error();
39
          }
40
      } else {
41
          \PHPUnit\Framework\TestCase::assertInternalType($expected, $actual, $message = '');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit\Framework\Assert::assertInternalType() has been deprecated with message: https://github.com/sebastianbergmann/phpunit/issues/3369

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
42
      }
43
    }
44
}