-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add clash endpoint tests, fix bugs
- Loading branch information
1 parent
a377fec
commit e7a6217
Showing
6 changed files
with
181 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a:3:{s:7:"headers";a:14:{s:4:"Date";s:29:"Sun, 11 Jun 2023 08:00:51 GMT";s:12:"Content-Type";s:30:"application/json;charset=utf-8";s:17:"Transfer-Encoding";s:7:"chunked";s:10:"Connection";s:10:"keep-alive";s:4:"Vary";s:15:"Accept-Encoding";s:16:"X-App-Rate-Limit";s:12:"20:1,100:120";s:22:"X-App-Rate-Limit-Count";s:9:"1:1,1:120";s:19:"X-Method-Rate-Limit";s:5:"10:60";s:25:"X-Method-Rate-Limit-Count";s:4:"1:60";s:20:"X-Riot-Edge-Trace-Id";s:36:"9ef5bd00-f133-420b-b712-eeb5c94ddd1b";s:27:"Access-Control-Allow-Origin";s:1:"*";s:28:"Access-Control-Allow-Methods";s:31:"GET, PUT, DELETE, POST, OPTIONS";s:28:"Access-Control-Allow-Headers";s:82:"DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";s:29:"Access-Control-Expose-Headers";s:28:"Content-Length,Content-Range";}s:8:"response";s:178:"{"id":27641,"themeId":1,"nameKey":"bandle_city","nameKeySecondary":"day_1","schedule":[{"id":27561,"registrationTime":1685803500000,"startTime":1685818800000,"cancelled":false}]}";s:4:"code";i:200;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a:3:{s:7:"headers";a:14:{s:4:"Date";s:29:"Sun, 11 Jun 2023 07:58:41 GMT";s:12:"Content-Type";s:30:"application/json;charset=utf-8";s:17:"Transfer-Encoding";s:7:"chunked";s:10:"Connection";s:10:"keep-alive";s:4:"Vary";s:15:"Accept-Encoding";s:16:"X-App-Rate-Limit";s:12:"20:1,100:120";s:22:"X-App-Rate-Limit-Count";s:9:"1:1,1:120";s:19:"X-Method-Rate-Limit";s:5:"10:60";s:25:"X-Method-Rate-Limit-Count";s:4:"1:60";s:20:"X-Riot-Edge-Trace-Id";s:36:"644b3a6b-2e3b-4eaa-bb60-b3d685c15171";s:27:"Access-Control-Allow-Origin";s:1:"*";s:28:"Access-Control-Allow-Methods";s:31:"GET, PUT, DELETE, POST, OPTIONS";s:28:"Access-Control-Allow-Headers";s:82:"DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";s:29:"Access-Control-Expose-Headers";s:28:"Content-Length,Content-Range";}s:8:"response";s:359:"[{"id":27721,"themeId":1,"nameKey":"bandle_city","nameKeySecondary":"day_4","schedule":[{"id":27641,"registrationTime":1687099500000,"startTime":1687114800000,"cancelled":false}]},{"id":27701,"themeId":1,"nameKey":"bandle_city","nameKeySecondary":"day_3","schedule":[{"id":27621,"registrationTime":1687013100000,"startTime":1687028400000,"cancelled":false}]}]";s:4:"code";i:200;} |
150 changes: 150 additions & 0 deletions
150
tests/LeagueAPI/EndpointObjectIntegrity/ClashEndpointObjectIntegrityTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright (C) 2016-2023 Daniel Dolejška | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LeagueAPI\EndpointObjectIntegrity; | ||
|
||
use RiotAPI\Base\Definitions\Region; | ||
use RiotAPI\LeagueAPI\LeagueAPI; | ||
use RiotAPI\LeagueAPI\Objects; | ||
use RiotAPI\Tests\RiotAPITestCase; | ||
|
||
|
||
class ClashEndpointObjectIntegrityTest extends RiotAPITestCase | ||
{ | ||
public function testInit() | ||
{ | ||
$api = new LeagueAPI([ | ||
LeagueAPI::SET_KEY => RiotAPITestCase::getApiKey(), | ||
LeagueAPI::SET_REGION => Region::EUROPE_EAST, | ||
LeagueAPI::SET_USE_DUMMY_DATA => true, | ||
LeagueAPI::SET_SAVE_DUMMY_DATA => getenv('SAVE_DUMMY_DATA') ?? false, | ||
]); | ||
|
||
$this->assertInstanceOf(LeagueAPI::class, $api); | ||
|
||
return $api; | ||
} | ||
|
||
/** | ||
* @depends testInit | ||
* | ||
* @param LeagueAPI $api | ||
*/ | ||
public function testGetTournaments(LeagueAPI $api) | ||
{ | ||
// Get library processed results | ||
/** @var Objects\ChallengeConfigInfoDto[] $result */ | ||
$result = $api->getTournaments(); | ||
// Get raw result | ||
$rawResult = $api->getResult(); | ||
|
||
$this->checkObjectPropertiesAndDataValidityOfObjectList($result, $rawResult, Objects\TournamentDto::class); | ||
} | ||
|
||
/** | ||
* @depends testInit | ||
* | ||
* @param LeagueAPI $api | ||
*/ | ||
public function testGetTournamentByTeam(LeagueAPI $api) | ||
{ | ||
$this->markTestSkipped("No DummyData available for this endpoint yet."); | ||
|
||
// Get library processed results | ||
/** @var Objects\ClashTeamDto $result */ | ||
$result = $api->getTournamentByTeam(""); | ||
// Get raw result | ||
$rawResult = $api->getResult(); | ||
|
||
$this->checkObjectPropertiesAndDataValidity($result, $rawResult, Objects\ClashTeamDto::class); | ||
} | ||
|
||
/** | ||
* @depends testInit | ||
* | ||
* @param LeagueAPI $api | ||
*/ | ||
public function testGetTournamentById(LeagueAPI $api) | ||
{ | ||
// Get library processed results | ||
/** @var Objects\TournamentDto $result */ | ||
$result = $api->getTournamentById(27641); | ||
// Get raw result | ||
$rawResult = $api->getResult(); | ||
|
||
$this->checkObjectPropertiesAndDataValidity($result, $rawResult, Objects\TournamentDto::class); | ||
} | ||
|
||
/** | ||
* @depends testInit | ||
* | ||
* @param LeagueAPI $api | ||
*/ | ||
public function testGetTournamentPlayersByPUUID(LeagueAPI $api) | ||
{ | ||
$this->markTestSkipped("No DummyData available for this endpoint yet."); | ||
|
||
// Get library processed results | ||
/** @var Objects\PlayerDto[] $result */ | ||
$result = $api->getTournamentPlayersByPUUID(""); | ||
// Get raw result | ||
$rawResult = $api->getResult(); | ||
|
||
$this->checkObjectPropertiesAndDataValidityOfObjectList($result, $rawResult, Objects\PlayerDto::class); | ||
} | ||
|
||
/** | ||
* @depends testInit | ||
* | ||
* @param LeagueAPI $api | ||
*/ | ||
public function testGetTournamentPlayersBySummoner(LeagueAPI $api) | ||
{ | ||
$this->markTestSkipped("No DummyData available for this endpoint yet."); | ||
|
||
// Get library processed results | ||
/** @var Objects\PlayerDto[] $result */ | ||
$result = $api->getTournamentPlayersBySummoner("LfgVCG8zj31owTI_L8s0TkHZCV4yDVJG_f_993LYz4sKdPzLqSERQn08FA"); | ||
// Get raw result | ||
$rawResult = $api->getResult(); | ||
|
||
$this->checkObjectPropertiesAndDataValidityOfObjectList($result, $rawResult, Objects\PlayerDto::class); | ||
} | ||
|
||
/** | ||
* @depends testInit | ||
* | ||
* @param LeagueAPI $api | ||
*/ | ||
public function testGetTournamentTeamById(LeagueAPI $api) | ||
{ | ||
$this->markTestSkipped("No DummyData available for this endpoint yet."); | ||
|
||
// Get library processed results | ||
/** @var Objects\PlayerDto[] $result */ | ||
$result = $api->getTournamentTeamById(""); | ||
// Get raw result | ||
$rawResult = $api->getResult(); | ||
|
||
$this->checkObjectPropertiesAndDataValidityOfObjectList($result, $rawResult, Objects\PlayerDto::class); | ||
} | ||
|
||
} |