From 7c34c0d28bcd92eb2f3b172e6ae3bd12f3d2e7c4 Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 13 Oct 2023 14:40:54 +0200 Subject: [PATCH] Add ruleset @PHPUnit84Migration --- .php-cs-fixer.dist.php | 2 ++ tests/Unit/V1/AttributesTest.php | 10 +++++----- tests/Unit/V1/JsonapiTest.php | 2 +- tests/Unit/V1/LinkTest.php | 2 +- tests/Unit/V1/MetaTest.php | 10 +++++----- tests/Unit/V1/RelationshipTest.php | 2 +- tests/Unit/V1/ResourceIdentifierTest.php | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index f032862..6de33d4 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -15,6 +15,8 @@ '@PER-CS2.0:risky' => true, '@PHP74Migration' => true, '@PHP74Migration:risky' => true, + '@PHPUnit84Migration:risky' => true, + 'no_alias_functions' => true, ]) ->setFinder($finder) ->setRiskyAllowed(true) diff --git a/tests/Unit/V1/AttributesTest.php b/tests/Unit/V1/AttributesTest.php index 56c64e0..865197c 100644 --- a/tests/Unit/V1/AttributesTest.php +++ b/tests/Unit/V1/AttributesTest.php @@ -53,15 +53,15 @@ public function testCreateWithObject(): void $this->assertInstanceOf(Accessable::class, $attributes); $this->assertTrue($attributes->has('object')); - $this->assertTrue(is_object($attributes->get('object'))); + $this->assertIsObject($attributes->get('object')); $this->assertTrue($attributes->has('array')); - $this->assertTrue(is_array($attributes->get('array'))); + $this->assertIsArray($attributes->get('array')); $this->assertTrue($attributes->has('string')); - $this->assertTrue(is_string($attributes->get('string'))); + $this->assertIsString($attributes->get('string')); $this->assertTrue($attributes->has('number_int')); - $this->assertTrue(is_int($attributes->get('number_int'))); + $this->assertIsInt($attributes->get('number_int')); $this->assertTrue($attributes->has('number_float')); - $this->assertTrue(is_float($attributes->get('number_float'))); + $this->assertIsFloat($attributes->get('number_float')); $this->assertTrue($attributes->has('true')); $this->assertTrue($attributes->get('true')); $this->assertTrue($attributes->has('false')); diff --git a/tests/Unit/V1/JsonapiTest.php b/tests/Unit/V1/JsonapiTest.php index eb4070d..ccbeb0a 100644 --- a/tests/Unit/V1/JsonapiTest.php +++ b/tests/Unit/V1/JsonapiTest.php @@ -116,6 +116,6 @@ public function testVersionCannotBeAnObjectOrArray($input): void // other input must be transformed to string $this->assertTrue($jsonapi->has('version')); - $this->assertTrue(is_string($jsonapi->get('version'))); + $this->assertIsString($jsonapi->get('version')); } } diff --git a/tests/Unit/V1/LinkTest.php b/tests/Unit/V1/LinkTest.php index b556234..e62d237 100644 --- a/tests/Unit/V1/LinkTest.php +++ b/tests/Unit/V1/LinkTest.php @@ -79,7 +79,7 @@ public function testHrefHasToBeAString($input): void $link = new Link($object, $this->manager, $this->parent); $this->assertTrue($link->has('href')); - $this->assertTrue(is_string($link->get('href'))); + $this->assertIsString($link->get('href')); return; } diff --git a/tests/Unit/V1/MetaTest.php b/tests/Unit/V1/MetaTest.php index 245541b..218ed5f 100644 --- a/tests/Unit/V1/MetaTest.php +++ b/tests/Unit/V1/MetaTest.php @@ -53,15 +53,15 @@ public function testCreateWithObject(): void $this->assertInstanceOf(Accessable::class, $meta); $this->assertTrue($meta->has('object')); - $this->assertTrue(is_object($meta->get('object'))); + $this->assertIsObject($meta->get('object')); $this->assertTrue($meta->has('array')); - $this->assertTrue(is_array($meta->get('array'))); + $this->assertIsArray($meta->get('array')); $this->assertTrue($meta->has('string')); - $this->assertTrue(is_string($meta->get('string'))); + $this->assertIsString($meta->get('string')); $this->assertTrue($meta->has('number_int')); - $this->assertTrue(is_int($meta->get('number_int'))); + $this->assertIsInt($meta->get('number_int')); $this->assertTrue($meta->has('number_float')); - $this->assertTrue(is_float($meta->get('number_float'))); + $this->assertIsFloat($meta->get('number_float')); $this->assertTrue($meta->has('true')); $this->assertTrue($meta->get('true')); $this->assertTrue($meta->has('false')); diff --git a/tests/Unit/V1/RelationshipTest.php b/tests/Unit/V1/RelationshipTest.php index 958fb7a..7574890 100644 --- a/tests/Unit/V1/RelationshipTest.php +++ b/tests/Unit/V1/RelationshipTest.php @@ -153,7 +153,7 @@ public function testCreateWithDataNull(): void $this->assertSame($relationship->getKeys(), ['data']); $this->assertTrue($relationship->has('data')); - $this->assertTrue(is_null($relationship->get('data'))); + $this->assertNull($relationship->get('data')); } /** diff --git a/tests/Unit/V1/ResourceIdentifierTest.php b/tests/Unit/V1/ResourceIdentifierTest.php index 1aeb729..65e4ff5 100644 --- a/tests/Unit/V1/ResourceIdentifierTest.php +++ b/tests/Unit/V1/ResourceIdentifierTest.php @@ -91,7 +91,7 @@ public function testTypeMustBeAString($input): void $identifier = new ResourceIdentifier($object, $this->manager, $this->parent); - $this->assertTrue(is_string($identifier->get('type'))); + $this->assertIsString($identifier->get('type')); } /**