diff --git a/.circleci/config.yml b/.circleci/config.yml index 0529e53..e9f7a99 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,25 +1,17 @@ version: 2 jobs: - "php-7.2": - docker: - - image: circleci/php:7.2 - steps: - - checkout - - run: composer install - - run: ./vendor/bin/phpunit - - "php-8.0": + "php-8.1": docker: - - image: circleci/php:8.0 + - image: cimg/php:8.1 steps: - checkout - run: composer install - run: ./vendor/bin/phpunit - "php-8.1": + "php-8.2": docker: - - image: cimg/php:8.1 + - image: cimg/php:8.2 steps: - checkout - run: composer install @@ -29,6 +21,5 @@ workflows: version: 2 build: jobs: - - "php-7.2" - - "php-8.0" - "php-8.1" + - "php-8.2" diff --git a/README.md b/README.md index 0f74a9e..616e9c3 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,12 @@ Create an instance of GamejoltApi and provide a GamejoltConfig to begin making API calls to Game Jolt. ```php +$gameId = 0; // Your game's ID +$gamePrivaykey = "Your game's private key"; + $api = new GamejoltApi(new GamejoltConfig( - 'mygameid', - 'mygameprivatekey' + $gameId, + $gamePrivaykey )); ``` diff --git a/composer.json b/composer.json index d41f418..daecc3c 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "authors": [ { "name": "Harry Kirkman", - "homepage": "https://harrykirkman.co.uk" + "homepage": "https://harrk.dev" } ], "description": "A PHP library for the Game Jolt API.", @@ -23,16 +23,16 @@ } }, "require": { - "php": "^7.2|^8.0", - "guzzlehttp/guzzle": "^6.5.7|^7.4.5", + "php": "^8.1|8.2", + "guzzlehttp/guzzle": "^7.5", "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^7.5|^9.3.3", - "phpstan/phpstan": "^0.11.0|^0.12.0" + "phpunit/phpunit": "^10.0", + "phpstan/phpstan": "^1.9.18" }, "scripts": { "test": "vendor/bin/phpunit", - "analyse": "vendor/bin/phpstan analyse ./src --level=5" + "analyse": "vendor/bin/phpstan analyse ./src --level 5" } } diff --git a/phpunit.xml b/phpunit.xml index ff118de..f668a85 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,27 +1,17 @@ - - - - - tests - - - - - - src/ - - - - - - + + + + src/ + + + + + tests + tests/GamejoltApiBaseTest.php + + + + + diff --git a/src/ApiCallService.php b/src/ApiCallService.php index 31727fc..d87e93f 100644 --- a/src/ApiCallService.php +++ b/src/ApiCallService.php @@ -3,6 +3,7 @@ namespace Harrk\GameJoltApi; use GuzzleHttp\Client; +use GuzzleHttp\Exception\GuzzleException; use Harrk\GameJoltApi\Exceptions\TimeOutException; use Harrk\GameJoltApi\Callers\AbstractCaller; use GuzzleHttp\Exception\ConnectException; @@ -35,11 +36,10 @@ public function __construct(AbstractCaller $caller) { } /** - * @return array * @throws TimeOutException - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException */ - public function execute() { + public function execute(): array { try { $request = $this->client->request( $this->method, diff --git a/src/Callers/AbstractCaller.php b/src/Callers/AbstractCaller.php index 8cfeba5..f441d14 100644 --- a/src/Callers/AbstractCaller.php +++ b/src/Callers/AbstractCaller.php @@ -6,28 +6,18 @@ use Harrk\GameJoltApi\GamejoltConfig; class AbstractCaller { + protected string $uri; + protected array $params; + protected GamejoltConfig $gameJoltConfig; - /** - * @var string - */ - protected $uri; - /** - * @var array - */ - protected $params; - - /** - * @var GamejoltConfig - */ - protected $gameJoltConfig; - - - public function __construct(GamejoltConfig $gamejoltConfig) { + public function __construct(GamejoltConfig $gamejoltConfig) + { $this->gameJoltConfig = $gamejoltConfig; } - protected function getSignature(string $url, array $params = []) { + protected function getSignature(string $url, array $params = []): string + { $urlWithPrivateKey = $url . $this->gameJoltConfig->getPrivateKey(); $toHashString = $urlWithPrivateKey; @@ -46,7 +36,8 @@ protected function getSignature(string $url, array $params = []) { return sha1($toHashString); } - public function getFullUrl($withSignature = false) { + public function getFullUrl(bool $withSignature = false) + { $url = $this->gameJoltConfig->getEndpoint() . $this->uri . '/'; $url .= '?' . http_build_query($this->getParams()); @@ -58,23 +49,18 @@ public function getFullUrl($withSignature = false) { return $url; } - public function call($uri, $params = []) { + public function call(string $uri, array $params = []): array + { $this->uri = $uri; - $this->params = array_merge( - [ - 'game_id' => $this->gameJoltConfig->getGameId() - ], - $params - ); - - $apiCallService = new ApiCallService($this); + $this->params = array_merge([ + 'game_id' => $this->gameJoltConfig->getGameId() + ], $params); - return $apiCallService->execute(); + return (new ApiCallService($this))->execute(); } - public function getParams() { - return array_filter((array) $this->params, function ($param) { - return ! empty($param); - }); + public function getParams(): array + { + return array_filter($this->params, static fn ($param) => ! empty($param)); } } diff --git a/src/Callers/DataStore.php b/src/Callers/DataStore.php index 457955c..8c4d2c1 100644 --- a/src/Callers/DataStore.php +++ b/src/Callers/DataStore.php @@ -5,14 +5,14 @@ use Harrk\GameJoltApi\Exceptions\InvalidParameterException; class DataStore extends AbstractCaller { - const OPERATION_ADD = 'add'; - const OPERATION_SUBTRACT = 'subtract'; - const OPERATION_MULTIPLY = 'multiply'; - const OPERATION_DIVIDE = 'divide'; - const OPERATION_APPEND = 'append'; - const OPERATION_PREPEND = 'prepend'; + public const OPERATION_ADD = 'add'; + public const OPERATION_SUBTRACT = 'subtract'; + public const OPERATION_MULTIPLY = 'multiply'; + public const OPERATION_DIVIDE = 'divide'; + public const OPERATION_APPEND = 'append'; + public const OPERATION_PREPEND = 'prepend'; - CONST OPERATIONS = [ + public const OPERATIONS = [ self::OPERATION_ADD, self::OPERATION_SUBTRACT, self::OPERATION_MULTIPLY, @@ -23,14 +23,9 @@ class DataStore extends AbstractCaller { /** * @link https://gamejolt.com/game-api/doc/data-store/fetch - * - * @param string $key - * @param null|string $username - * @param null|string $user_token - * - * @return array */ - public function fetch($key, $username = null, $user_token = null) { + public function fetch(string $key, ?string $username = null, ?string $user_token = null): array + { return $this->call('data-store', compact( 'key', 'username', 'user_token' )); @@ -38,14 +33,9 @@ public function fetch($key, $username = null, $user_token = null) { /** * @link https://gamejolt.com/game-api/doc/data-store/get-keys - * - * @param null|string $pattern - * @param null|string $username - * @param null|string $user_token - * - * @return array */ - public function getKeys($pattern = null, $username = null, $user_token = null) { + public function getKeys(?string $pattern = null, ?string $username = null, ?string $user_token = null): array + { return $this->call('data-store/get-keys', compact( 'pattern', 'username', 'user_token' )); @@ -53,14 +43,9 @@ public function getKeys($pattern = null, $username = null, $user_token = null) { /** * @link https://gamejolt.com/game-api/doc/data-store/remove - * - * @param string $key - * @param null|string $username - * @param null|string $user_token - * - * @return array */ - public function remove($key, $username = null, $user_token = null) { + public function remove(string $key, ?string $username = null, ?string $user_token = null): array + { return $this->call('data-store/remove', compact( 'key', 'username', 'user_token' )); diff --git a/src/Callers/Friends.php b/src/Callers/Friends.php index fbe6908..4f49e3e 100644 --- a/src/Callers/Friends.php +++ b/src/Callers/Friends.php @@ -6,13 +6,9 @@ class Friends extends AbstractCaller { /** * @link https://gamejolt.com/game-api/doc/friends/fetch - * - * @param string $username - * @param string $user_token - * - * @return array */ - public function fetch($username, $user_token) { + public function fetch(string $username, string $user_token): array + { return $this->call('friends', compact( 'username', 'user_token' )); diff --git a/src/Callers/Scores.php b/src/Callers/Scores.php index 99e8612..8ca7b6e 100644 --- a/src/Callers/Scores.php +++ b/src/Callers/Scores.php @@ -6,18 +6,17 @@ class Scores extends AbstractCaller { /** * @link https://gamejolt.com/game-api/doc/scores/fetch - * - * @param null|string $username - * @param null|string $user_token - * @param null|integer $table_id - * @param null|integer $limit - * @param null|string $guest - * @param null|integer $better_than - * @param null|integer $worse_than - * - * @return array */ - public function fetch($username = null, $user_token = null, $table_id = null, $limit = null, $guest = null, $better_than = null, $worse_than = null) { + public function fetch( + ?string $username = null, + ?string $user_token = null, + ?int $table_id = null, + ?int $limit = null, + ?string $guest = null, + ?int $better_than = null, + ?int $worse_than = null + ): array + { return $this->call('scores', compact( 'username', 'user_token', 'table_id', 'limit', 'guest', 'better_than', 'worse_than' )); @@ -25,26 +24,24 @@ public function fetch($username = null, $user_token = null, $table_id = null, $l /** * @link https://gamejolt.com/game-api/doc/scores/tables - * - * @return array */ - public function tables() { + public function tables(): array + { return $this->call('scores/tables'); } /** * @link https://gamejolt.com/game-api/doc/scores/add - * - * @param string $username - * @param string $user_token - * @param string $score - * @param integer $sort - * @param null|integer $table_id - * @param null|string $extra_data - * - * @return array */ - public function addUserScore($username, $user_token, $score, $sort, $table_id = null, $extra_data = null) { + public function addUserScore( + string $username, + string $user_token, + string $score, + int $sort, + ?int $table_id = null, + ?string $extra_data = null + ): array + { return $this->call('scores/add', compact( 'username', 'user_token', 'score', 'sort', 'table_id', 'extra_data' )); @@ -52,16 +49,15 @@ public function addUserScore($username, $user_token, $score, $sort, $table_id = /** * @link https://gamejolt.com/game-api/doc/scores/add - * - * @param string $guest - * @param string $score - * @param integer $sort - * @param null|integer $table_id - * @param null|string $extra_data - * - * @return array */ - public function addGuestScore($guest, $score, $sort, $table_id = null, $extra_data = null) { + public function addGuestScore( + string $guest, + string $score, + int $sort, + ?int $table_id = null, + ?string $extra_data = null + ): array + { return $this->call('scores/add', compact( 'guest', 'score', 'sort', 'table_id', 'extra_data' )); @@ -69,13 +65,9 @@ public function addGuestScore($guest, $score, $sort, $table_id = null, $extra_da /** * @link https://gamejolt.com/game-api/doc/scores/get-rank - * - * @param integer $sort - * @param null|integer $table_id - * - * @return array */ - public function getRank($sort, $table_id = null) { + public function getRank(int $sort, ?int $table_id = null): array + { return $this->call('scores/get-rank', compact('sort', 'table_id')); } } diff --git a/src/Callers/Sessions.php b/src/Callers/Sessions.php index c80c4d6..494c0f5 100644 --- a/src/Callers/Sessions.php +++ b/src/Callers/Sessions.php @@ -5,23 +5,19 @@ use Harrk\GameJoltApi\Exceptions\InvalidParameterException; class Sessions extends AbstractCaller { - const STATUS_ACTIVE = 'active'; - const STATUS_IDLE = 'idle'; + public const STATUS_ACTIVE = 'active'; + public const STATUS_IDLE = 'idle'; - const STATUSES = [ + public const STATUSES = [ self::STATUS_ACTIVE, self::STATUS_IDLE, ]; /** * @link https://gamejolt.com/game-api/doc/sessions/open - * - * @param string $username - * @param string $user_token - * - * @return array */ - public function open($username, $user_token) { + public function open(string $username, string $user_token): array + { return $this->call('sessions/open', compact( 'username', 'user_token' )); @@ -30,15 +26,10 @@ public function open($username, $user_token) { /** * @link https://gamejolt.com/game-api/doc/sessions/ping * - * @param string $username - * @param string $user_token - * @param string|null $status - * - * @return array - * * @throws InvalidParameterException */ - public function ping($username, $user_token, string $status = null) { + public function ping(string $username, string $user_token, ?string $status = null): array + { if (null !== $status) { if (! in_array($status, self::STATUSES)) { throw new InvalidParameterException( @@ -54,13 +45,9 @@ public function ping($username, $user_token, string $status = null) { /** * @link https://gamejolt.com/game-api/doc/sessions/check - * - * @param string $username - * @param string $user_token - * - * @return array */ - public function check($username, $user_token) { + public function check(string $username, string $user_token): array + { return $this->call('sessions/check', compact( 'username', 'user_token' )); @@ -68,13 +55,9 @@ public function check($username, $user_token) { /** * @link https://gamejolt.com/game-api/doc/sessions/close - * - * @param string $username - * @param string $user_token - * - * @return array */ - public function close($username, $user_token) { + public function close(string $username, string $user_token): array + { return $this->call('sessions/close', compact( 'username', 'user_token' )); diff --git a/src/Callers/Time.php b/src/Callers/Time.php index c074730..4712d60 100644 --- a/src/Callers/Time.php +++ b/src/Callers/Time.php @@ -6,10 +6,9 @@ class Time extends AbstractCaller { /** * @link https://gamejolt.com/game-api/doc/time/fetch - * - * @return array */ - public function fetch() { + public function fetch(): array + { return $this->call('time/time'); } diff --git a/src/Callers/Trophies.php b/src/Callers/Trophies.php index be5595b..f0a3386 100644 --- a/src/Callers/Trophies.php +++ b/src/Callers/Trophies.php @@ -6,15 +6,9 @@ class Trophies extends AbstractCaller { /** * @link https://gamejolt.com/game-api/doc/trophies/fetch - * - * @param string $username - * @param string $user_token - * @param bool $achieved - * @param integer[] $trophy_ids - * - * @return array */ - public function fetch($username, $user_token, $achieved = false, array $trophy_ids = []) { + public function fetch(string $username, string $user_token, bool $achieved = false, array $trophy_ids = []): array + { $trophy_id = implode(',', $trophy_ids); return $this->call('trophies', compact( @@ -24,14 +18,9 @@ public function fetch($username, $user_token, $achieved = false, array $trophy_i /** * @link https://gamejolt.com/game-api/doc/trophies/add-achieved - * - * @param string $username - * @param string $user_token - * @param integer $trophy_id - * - * @return array */ - public function addAchieved($username, $user_token, $trophy_id) { + public function addAchieved(string $username, string $user_token, int $trophy_id): array + { return $this->call('trophies/add-achieved', compact( 'username', 'user_token', 'trophy_id' )); @@ -39,14 +28,9 @@ public function addAchieved($username, $user_token, $trophy_id) { /** * @link https://gamejolt.com/game-api/doc/trophies/remove-achieved - * - * @param string $username - * @param string $user_token - * @param integer $trophy_id - * - * @return array */ - public function removeAchieved($username, $user_token, $trophy_id) { + public function removeAchieved(string $username, string $user_token, int $trophy_id): array + { return $this->call('trophies/remove-achieved', compact( 'username', 'user_token', 'trophy_id' )); diff --git a/src/Callers/Users.php b/src/Callers/Users.php index 3a489cc..fc2b3c0 100644 --- a/src/Callers/Users.php +++ b/src/Callers/Users.php @@ -6,13 +6,9 @@ class Users extends AbstractCaller { /** * @link https://gamejolt.com/game-api/doc/users/fetch - * - * @param string $username - * @param string $user_token - * - * @return array */ - public function fetch($username, $user_token) { + public function fetch(string $username, string $user_token): array + { return $this->call('users', compact( 'username', 'user_token' )); @@ -20,13 +16,9 @@ public function fetch($username, $user_token) { /** * @link https://gamejolt.com/game-api/doc/users/auth - * - * @param string $username - * @param string $user_token - * - * @return array */ - public function auth($username, $user_token) { + public function auth(string $username, string $user_token): array + { return $this->call('users/auth', compact( 'username', 'user_token' )); diff --git a/src/Exceptions/InvalidParameterException.php b/src/Exceptions/InvalidParameterException.php index 7228d34..0c06418 100644 --- a/src/Exceptions/InvalidParameterException.php +++ b/src/Exceptions/InvalidParameterException.php @@ -2,5 +2,7 @@ namespace Harrk\GameJoltApi\Exceptions; -class InvalidParameterException extends \Exception { +use Exception; + +class InvalidParameterException extends Exception { } diff --git a/src/Exceptions/TimeOutException.php b/src/Exceptions/TimeOutException.php index 763a38d..3bfa2ba 100644 --- a/src/Exceptions/TimeOutException.php +++ b/src/Exceptions/TimeOutException.php @@ -2,5 +2,7 @@ namespace Harrk\GameJoltApi\Exceptions; -class TimeOutException extends \Exception { +use Exception; + +class TimeOutException extends Exception { } diff --git a/src/GamejoltApi.php b/src/GamejoltApi.php index 65f4b8a..131b7e5 100644 --- a/src/GamejoltApi.php +++ b/src/GamejoltApi.php @@ -11,73 +11,69 @@ use Harrk\GameJoltApi\Callers\Users; class GamejoltApi { - - /** - * @var GamejoltConfig - */ - protected $gameJoltConfig; + protected GamejoltConfig $gameJoltConfig; /** * Initialise the API with a provided config - * @param GamejoltConfig $gamejoltConfig */ - public function __construct(GamejoltConfig $gamejoltConfig) { + public function __construct(GamejoltConfig $gamejoltConfig) + { $this->gameJoltConfig = $gamejoltConfig; } /** * Access the time API - * @return Time */ - public function time(): Time { + public function time(): Time + { return new Time($this->gameJoltConfig); } /** * Access the trophies API - * @return Trophies */ - public function trophies(): Trophies { + public function trophies(): Trophies + { return new Trophies($this->gameJoltConfig); } /** * Access the users API - * @return Users */ - public function users(): Users { + public function users(): Users + { return new Users($this->gameJoltConfig); } /** * Access the sessions API - * @return Sessions */ - public function sessions(): Sessions { + public function sessions(): Sessions + { return new Sessions($this->gameJoltConfig); } /** * Access the scores API - * @return Scores */ - public function scores(): Scores { + public function scores(): Scores + { return new Scores($this->gameJoltConfig); } /** * Access the dataStore API - * @return DataStore */ - public function dataStore(): DataStore { + public function dataStore(): DataStore + { return new DataStore($this->gameJoltConfig); } /** * Access the friends API - * @return Friends */ - public function friends(): Friends { + public function friends(): Friends + { return new Friends($this->gameJoltConfig); } diff --git a/src/GamejoltConfig.php b/src/GamejoltConfig.php index 48f3ae6..82e4755 100644 --- a/src/GamejoltConfig.php +++ b/src/GamejoltConfig.php @@ -3,28 +3,12 @@ namespace Harrk\GameJoltApi; class GamejoltConfig { + protected string $endpoint = 'https://api.gamejolt.com/api/game/v1_2/'; + protected string $privateKey; + protected int $gameId; - /** - * @var string Game Jolt API Endpoint - */ - protected $endpoint = 'https://api.gamejolt.com/api/game/v1_2/'; - - /** - * @var string Game Jolt game private key - */ - protected $privateKey; - - /** - * @var int Game Jolt game ID - */ - protected $gameId; - - /** - * @param int $gameId - * @param string $privateKey - * @param null|string $endpoint - */ - public function __construct($gameId, $privateKey, $endpoint = null) { + public function __construct(int $gameId, string $privateKey, ?string $endpoint = null) + { $this->privateKey = $privateKey; $this->gameId = $gameId; @@ -35,25 +19,25 @@ public function __construct($gameId, $privateKey, $endpoint = null) { /** * Retrieve the game's private key - * @return string */ - public function getPrivateKey() { + public function getPrivateKey(): string + { return $this->privateKey; } /** * Retrieve the game's id - * @return int */ - public function getGameId() { + public function getGameId(): int + { return $this->gameId; } /** * Retrieve Game Jolt's API endpoint - * @return string */ - public function getEndpoint() { + public function getEndpoint(): string + { return $this->endpoint; } } diff --git a/tests/GamejoltApiBaseTest.php b/tests/GamejoltApiBaseTest.php new file mode 100644 index 0000000..6cf05e7 --- /dev/null +++ b/tests/GamejoltApiBaseTest.php @@ -0,0 +1,24 @@ +api = new GamejoltApi($config); + } +} diff --git a/tests/GamejoltApiDataStoreTest.php b/tests/GamejoltApiDataStoreTest.php new file mode 100644 index 0000000..5f1e4ee --- /dev/null +++ b/tests/GamejoltApiDataStoreTest.php @@ -0,0 +1,15 @@ +api->dataStore(); + + $this->assertEquals(DataStore::class, get_class($dataStore)); + } +} diff --git a/tests/GamejoltApiFriendsTest.php b/tests/GamejoltApiFriendsTest.php new file mode 100644 index 0000000..6249811 --- /dev/null +++ b/tests/GamejoltApiFriendsTest.php @@ -0,0 +1,15 @@ +api->friends(); + + $this->assertEquals(Friends::class, get_class($friends)); + } +} diff --git a/tests/GamejoltApiScoresTest.php b/tests/GamejoltApiScoresTest.php new file mode 100644 index 0000000..b39356f --- /dev/null +++ b/tests/GamejoltApiScoresTest.php @@ -0,0 +1,15 @@ +api->scores(); + + $this->assertEquals(Scores::class, get_class($scores)); + } +} diff --git a/tests/GamejoltApiSessionsTest.php b/tests/GamejoltApiSessionsTest.php new file mode 100644 index 0000000..a947773 --- /dev/null +++ b/tests/GamejoltApiSessionsTest.php @@ -0,0 +1,15 @@ +api->sessions(); + + $this->assertEquals(Sessions::class, get_class($sessions)); + } +} diff --git a/tests/GamejoltApiTest.php b/tests/GamejoltApiTest.php deleted file mode 100644 index e9bac39..0000000 --- a/tests/GamejoltApiTest.php +++ /dev/null @@ -1,74 +0,0 @@ -api = new GamejoltApi($config); - } - - public function testDataStore() { - $dataStore = $this->api->dataStore(); - - $this->assertEquals(DataStore::class, get_class($dataStore)); - } - - public function testFriends() { - $friends = $this->api->friends(); - - $this->assertEquals(Friends::class, get_class($friends)); - } - - public function testScores() { - $scores = $this->api->scores(); - - $this->assertEquals(Scores::class, get_class($scores)); - } - - public function testSessions() { - $sessions = $this->api->sessions(); - - $this->assertEquals(Sessions::class, get_class($sessions)); - } - - public function testTime() { - $time = $this->api->time(); - - $this->assertEquals(Time::class, get_class($time)); - } - - public function testTrophies() { - $trophies = $this->api->trophies(); - - $this->assertEquals(Trophies::class, get_class($trophies)); - } - - public function testUsers() { - $users = $this->api->users(); - - $this->assertEquals(Users::class, get_class($users)); - } -} diff --git a/tests/GamejoltApiTimeTest.php b/tests/GamejoltApiTimeTest.php new file mode 100644 index 0000000..72e3a02 --- /dev/null +++ b/tests/GamejoltApiTimeTest.php @@ -0,0 +1,15 @@ +api->time(); + + $this->assertEquals(Time::class, get_class($time)); + } +} diff --git a/tests/GamejoltApiTrophiesTest.php b/tests/GamejoltApiTrophiesTest.php new file mode 100644 index 0000000..eca873a --- /dev/null +++ b/tests/GamejoltApiTrophiesTest.php @@ -0,0 +1,15 @@ +api->trophies(); + + $this->assertEquals(Trophies::class, get_class($trophies)); + } +} diff --git a/tests/GamejoltApiUsersTest.php b/tests/GamejoltApiUsersTest.php new file mode 100644 index 0000000..faf33ac --- /dev/null +++ b/tests/GamejoltApiUsersTest.php @@ -0,0 +1,15 @@ +api->users(); + + $this->assertEquals(Users::class, get_class($users)); + } +} diff --git a/tests/GamejoltConfigTest.php b/tests/GamejoltConfigTest.php index aa571e8..d35dda7 100644 --- a/tests/GamejoltConfigTest.php +++ b/tests/GamejoltConfigTest.php @@ -12,24 +12,28 @@ class GamejoltConfigTest extends TestCase { */ private $config; - protected function setUp(): void { + protected function setUp(): void + { parent::setUp(); $this->config = new GamejoltConfig( - 'my-game-id', + 0, 'my-game-private-key' ); } - public function testConfigGameId() { - $this->assertEquals('my-game-id', $this->config->getGameId()); + public function testConfigGameId(): void + { + $this->assertEquals(0, $this->config->getGameId()); } - public function testConfigPrivateKey() { + public function testConfigPrivateKey(): void + { $this->assertEquals('my-game-private-key', $this->config->getPrivateKey()); } - public function testConfigEndpoint() { + public function testConfigEndpoint(): void + { $this->assertEquals('https://api.gamejolt.com/api/game/v1_2/', $this->config->getEndpoint()); } }