Skip to content

Commit

Permalink
Tests: replace assert[Not]InternalType( 'float', $var ) with `asser…
Browse files Browse the repository at this point in the history
…tIs[Not]Float()`

The `assertInternalType()` and `assertNotInternalType()` methods were soft deprecated in PHPUnit 7.5, hard deprecated in PHPUnit 8.0 and the functionality was removed in PHPUnit 9.0.

The more specific `assertIsArray()`, `assertIsNotArray()`, `assertIsBool()`, `assertIsNotBool()`, `assertIsFloat()`, `assertIsNotFloat()`, `assertIsInt()`, `assertIsNotInt()`, `assertIsNumeric()`, `assertIsNotNumeric()`, `assertIsObject()`, `assertIsNotObject()`, `assertIsResource()`, `assertIsNotResource()`, `assertIsString()`,
`assertIsNotString()`, `assertIsScalar()`, `assertIsNotScalar()`, `assertIsCallable()`, `assertIsNotCallable()`, `assertIsIterable()`, `assertIsNotIterable()` methods were introduced as replacements in PHPUnit 7.5.

Ref:
* https://github.com/sebastianbergmann/phpunit/blob/7.5.20/ChangeLog-7.5.md#750---2018-12-07
* sebastianbergmann/phpunit#3368
  • Loading branch information
jrfnl committed Aug 16, 2020
1 parent 790233c commit b03f1bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/phpunit/tests/rest-api/rest-post-meta-fields.php
Expand Up @@ -399,7 +399,7 @@ public function test_get_value_types() {
$this->assertSame( '42', $meta['test_string'] );

$this->assertArrayHasKey( 'test_number', $meta );
$this->assertInternalType( 'float', $meta['test_number'] );
$this->assertIsFloat( $meta['test_number'] );
$this->assertSame( 42.0, $meta['test_number'] );

$this->assertArrayHasKey( 'test_bool', $meta );
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/rest-api/rest-term-meta-fields.php
Expand Up @@ -346,7 +346,7 @@ public function test_get_value_types() {
$this->assertSame( '42', $meta['test_string'] );

$this->assertArrayHasKey( 'test_number', $meta );
$this->assertInternalType( 'float', $meta['test_number'] );
$this->assertIsFloat( $meta['test_number'] );
$this->assertSame( 42.0, $meta['test_number'] );

$this->assertArrayHasKey( 'test_bool', $meta );
Expand Down

0 comments on commit b03f1bc

Please sign in to comment.