From 9df860b08b58be122d259c694d6778d43ac4bcbf Mon Sep 17 00:00:00 2001 From: Jens True Date: Fri, 16 Aug 2024 07:57:08 +0000 Subject: [PATCH] SkillTest deprecated method --- composer.lock | 64 +++++++++---------- src/SkillCalculator.php | 4 +- tests/SkillCalculatorTest.php | 29 +++++++++ .../FactorGraphTrueSkillCalculatorTest.php | 2 +- 4 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 tests/SkillCalculatorTest.php diff --git a/composer.lock b/composer.lock index 0a596f5..777646f 100644 --- a/composer.lock +++ b/composer.lock @@ -352,16 +352,16 @@ }, { "name": "amphp/sync", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/amphp/sync.git", - "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec" + "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/sync/zipball/375ef5b54a0d12c38e12728dde05a55e30f2fbec", - "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec", + "url": "https://api.github.com/repos/amphp/sync/zipball/217097b785130d77cfcc58ff583cf26cd1770bf1", + "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1", "shasum": "" }, "require": { @@ -415,7 +415,7 @@ ], "support": { "issues": "https://github.com/amphp/sync/issues", - "source": "https://github.com/amphp/sync/tree/v2.2.0" + "source": "https://github.com/amphp/sync/tree/v2.3.0" }, "funding": [ { @@ -423,7 +423,7 @@ "type": "github" } ], - "time": "2024-03-12T01:00:01+00:00" + "time": "2024-08-03T19:31:26+00:00" }, { "name": "composer/package-versions-deprecated", @@ -1644,16 +1644,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.8", + "version": "1.11.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec" + "reference": "640410b32995914bde3eed26fa89552f9c2c082f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", - "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f", + "reference": "640410b32995914bde3eed26fa89552f9c2c082f", "shasum": "" }, "require": { @@ -1698,7 +1698,7 @@ "type": "github" } ], - "time": "2024-07-24T07:01:22+00:00" + "time": "2024-08-08T09:02:50+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2025,16 +2025,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.9", + "version": "11.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c197bbaaca360efda351369bf1fd9cc1ca6bcbf7" + "reference": "fe179875ef0c14e90b75617002767eae0a742641" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c197bbaaca360efda351369bf1fd9cc1ca6bcbf7", - "reference": "c197bbaaca360efda351369bf1fd9cc1ca6bcbf7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fe179875ef0c14e90b75617002767eae0a742641", + "reference": "fe179875ef0c14e90b75617002767eae0a742641", "shasum": "" }, "require": { @@ -2055,7 +2055,7 @@ "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", "sebastian/code-unit": "^3.0.1", - "sebastian/comparator": "^6.0.1", + "sebastian/comparator": "^6.0.2", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.0", "sebastian/exporter": "^6.1.3", @@ -2073,7 +2073,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.2-dev" + "dev-main": "11.3-dev" } }, "autoload": { @@ -2105,7 +2105,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.1" }, "funding": [ { @@ -2121,7 +2121,7 @@ "type": "tidelift" } ], - "time": "2024-07-30T11:09:23+00:00" + "time": "2024-08-13T06:14:23+00:00" }, { "name": "psalm/plugin-phpunit", @@ -2288,21 +2288,21 @@ }, { "name": "rector/rector", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "044e6364017882d1e346da8690eeabc154da5495" + "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/044e6364017882d1e346da8690eeabc154da5495", - "reference": "044e6364017882d1e346da8690eeabc154da5495", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2433e95410aef1b34b15d7f1b6a134365a4ddb39", + "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.11.9" }, "conflict": { "rector/rector-doctrine": "*", @@ -2335,7 +2335,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.2" + "source": "https://github.com/rectorphp/rector/tree/1.2.3" }, "funding": [ { @@ -2343,7 +2343,7 @@ "type": "github" } ], - "time": "2024-07-25T07:44:34+00:00" + "time": "2024-08-12T16:36:46+00:00" }, { "name": "revolt/event-loop", @@ -2589,16 +2589,16 @@ }, { "name": "sebastian/comparator", - "version": "6.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "131942b86d3587291067a94f295498ab6ac79c20" + "reference": "450d8f237bd611c45b5acf0733ce43e6bb280f81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/131942b86d3587291067a94f295498ab6ac79c20", - "reference": "131942b86d3587291067a94f295498ab6ac79c20", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/450d8f237bd611c45b5acf0733ce43e6bb280f81", + "reference": "450d8f237bd611c45b5acf0733ce43e6bb280f81", "shasum": "" }, "require": { @@ -2654,7 +2654,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.2" }, "funding": [ { @@ -2662,7 +2662,7 @@ "type": "github" } ], - "time": "2024-07-03T04:48:07+00:00" + "time": "2024-08-12T06:07:25+00:00" }, { "name": "sebastian/complexity", diff --git a/src/SkillCalculator.php b/src/SkillCalculator.php index 5ef4572..905257a 100644 --- a/src/SkillCalculator.php +++ b/src/SkillCalculator.php @@ -52,7 +52,7 @@ abstract class SkillCalculator public function isSupported(int $option): bool { - return (bool)($this->supportedOptions & $option) == $option; + return ($this->supportedOptions & $option) === $option; } /** @@ -64,7 +64,7 @@ abstract class SkillCalculator } /** - * @param array<\DNW\Skills\Team> $teams + * @param Team[] $teams * * @throws \Exception */ diff --git a/tests/SkillCalculatorTest.php b/tests/SkillCalculatorTest.php new file mode 100644 index 0000000..8a79431 --- /dev/null +++ b/tests/SkillCalculatorTest.php @@ -0,0 +1,29 @@ +getMockForAbstractClass(SkillCalculator::class, [SkillCalculator::PARTIAL_PLAY, new TeamsRange(1, 2), new PlayersRange(1, 2)]); + + $this->assertEquals(TRUE, $calculator->isSupported(SkillCalculator::PARTIAL_PLAY)); + $this->assertEquals(FALSE, $calculator->isSupported(SkillCalculator::PARTIAL_UPDATE)); + } +} diff --git a/tests/TrueSkill/FactorGraphTrueSkillCalculatorTest.php b/tests/TrueSkill/FactorGraphTrueSkillCalculatorTest.php index 1157a59..9c412ec 100644 --- a/tests/TrueSkill/FactorGraphTrueSkillCalculatorTest.php +++ b/tests/TrueSkill/FactorGraphTrueSkillCalculatorTest.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace DNW\Skills\Tests\TrueSkill; +use DNW\Skills\SkillCalculator; use DNW\Skills\GameInfo; use DNW\Skills\Player; use DNW\Skills\Team; use DNW\Skills\TrueSkill\FactorGraphTrueSkillCalculator; -use DNW\Skills\SkillCalculator; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversNothing;