SkillTest deprecated method
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Jens True 2024-08-16 07:57:08 +00:00
parent 1e381bfab7
commit 9df860b08b
4 changed files with 64 additions and 35 deletions

64
composer.lock generated

@ -352,16 +352,16 @@
}, },
{ {
"name": "amphp/sync", "name": "amphp/sync",
"version": "v2.2.0", "version": "v2.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/amphp/sync.git", "url": "https://github.com/amphp/sync.git",
"reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec" "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/amphp/sync/zipball/375ef5b54a0d12c38e12728dde05a55e30f2fbec", "url": "https://api.github.com/repos/amphp/sync/zipball/217097b785130d77cfcc58ff583cf26cd1770bf1",
"reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec", "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -415,7 +415,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/amphp/sync/issues", "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": [ "funding": [
{ {
@ -423,7 +423,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-03-12T01:00:01+00:00" "time": "2024-08-03T19:31:26+00:00"
}, },
{ {
"name": "composer/package-versions-deprecated", "name": "composer/package-versions-deprecated",
@ -1644,16 +1644,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.11.8", "version": "1.11.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec" "reference": "640410b32995914bde3eed26fa89552f9c2c082f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f",
"reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", "reference": "640410b32995914bde3eed26fa89552f9c2c082f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1698,7 +1698,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-07-24T07:01:22+00:00" "time": "2024-08-08T09:02:50+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -2025,16 +2025,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "11.2.9", "version": "11.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "c197bbaaca360efda351369bf1fd9cc1ca6bcbf7" "reference": "fe179875ef0c14e90b75617002767eae0a742641"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c197bbaaca360efda351369bf1fd9cc1ca6bcbf7", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fe179875ef0c14e90b75617002767eae0a742641",
"reference": "c197bbaaca360efda351369bf1fd9cc1ca6bcbf7", "reference": "fe179875ef0c14e90b75617002767eae0a742641",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2055,7 +2055,7 @@
"phpunit/php-timer": "^7.0.1", "phpunit/php-timer": "^7.0.1",
"sebastian/cli-parser": "^3.0.2", "sebastian/cli-parser": "^3.0.2",
"sebastian/code-unit": "^3.0.1", "sebastian/code-unit": "^3.0.1",
"sebastian/comparator": "^6.0.1", "sebastian/comparator": "^6.0.2",
"sebastian/diff": "^6.0.2", "sebastian/diff": "^6.0.2",
"sebastian/environment": "^7.2.0", "sebastian/environment": "^7.2.0",
"sebastian/exporter": "^6.1.3", "sebastian/exporter": "^6.1.3",
@ -2073,7 +2073,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "11.2-dev" "dev-main": "11.3-dev"
} }
}, },
"autoload": { "autoload": {
@ -2105,7 +2105,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "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": [ "funding": [
{ {
@ -2121,7 +2121,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-07-30T11:09:23+00:00" "time": "2024-08-13T06:14:23+00:00"
}, },
{ {
"name": "psalm/plugin-phpunit", "name": "psalm/plugin-phpunit",
@ -2288,21 +2288,21 @@
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "1.2.2", "version": "1.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "044e6364017882d1e346da8690eeabc154da5495" "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/044e6364017882d1e346da8690eeabc154da5495", "url": "https://api.github.com/repos/rectorphp/rector/zipball/2433e95410aef1b34b15d7f1b6a134365a4ddb39",
"reference": "044e6364017882d1e346da8690eeabc154da5495", "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2|^8.0", "php": "^7.2|^8.0",
"phpstan/phpstan": "^1.11" "phpstan/phpstan": "^1.11.9"
}, },
"conflict": { "conflict": {
"rector/rector-doctrine": "*", "rector/rector-doctrine": "*",
@ -2335,7 +2335,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "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": [ "funding": [
{ {
@ -2343,7 +2343,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-07-25T07:44:34+00:00" "time": "2024-08-12T16:36:46+00:00"
}, },
{ {
"name": "revolt/event-loop", "name": "revolt/event-loop",
@ -2589,16 +2589,16 @@
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
"version": "6.0.1", "version": "6.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git", "url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "131942b86d3587291067a94f295498ab6ac79c20" "reference": "450d8f237bd611c45b5acf0733ce43e6bb280f81"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/131942b86d3587291067a94f295498ab6ac79c20", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/450d8f237bd611c45b5acf0733ce43e6bb280f81",
"reference": "131942b86d3587291067a94f295498ab6ac79c20", "reference": "450d8f237bd611c45b5acf0733ce43e6bb280f81",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2654,7 +2654,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues", "issues": "https://github.com/sebastianbergmann/comparator/issues",
"security": "https://github.com/sebastianbergmann/comparator/security/policy", "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": [ "funding": [
{ {
@ -2662,7 +2662,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-07-03T04:48:07+00:00" "time": "2024-08-12T06:07:25+00:00"
}, },
{ {
"name": "sebastian/complexity", "name": "sebastian/complexity",

@ -52,7 +52,7 @@ abstract class SkillCalculator
public function isSupported(int $option): bool 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 * @throws \Exception
*/ */

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace DNW\Skills\Tests;
use DNW\Skills\SkillCalculator;
use DNW\Skills\TeamsRange;
use DNW\Skills\PlayersRange;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
#[CoversClass(SkillCalculator::class)]
#[UsesClass(\DNW\Skills\Numerics\Range::class)]
#[UsesClass(PlayersRange::class)]
#[UsesClass(TeamsRange::class)]
#[RequiresPhpunit('<12.0')]
class SkillCalculatorTest extends TestCase
{
public function testisSupported(): void
{
$calculator = $this->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));
}
}

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace DNW\Skills\Tests\TrueSkill; namespace DNW\Skills\Tests\TrueSkill;
use DNW\Skills\SkillCalculator;
use DNW\Skills\GameInfo; use DNW\Skills\GameInfo;
use DNW\Skills\Player; use DNW\Skills\Player;
use DNW\Skills\Team; use DNW\Skills\Team;
use DNW\Skills\TrueSkill\FactorGraphTrueSkillCalculator; use DNW\Skills\TrueSkill\FactorGraphTrueSkillCalculator;
use DNW\Skills\SkillCalculator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\Attributes\CoversNothing;