syntaxerrors /
Steam
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use Orchestra\Testbench\TestCase; |
||
| 4 | use Syntax\SteamApi\Client; |
||
| 5 | use Dotenv\Dotenv; |
||
| 6 | |||
| 7 | class BaseTester extends TestCase { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 8 | |||
| 9 | protected $id32 = 'STEAM_1:1:31085444'; |
||
| 10 | |||
| 11 | protected $id64 = 76561198022436617; |
||
| 12 | |||
| 13 | protected $id3 = '[U:1:62170889]'; |
||
| 14 | |||
| 15 | protected $altId64 = 76561197979958413; |
||
| 16 | |||
| 17 | protected $appId = 620; |
||
| 18 | |||
| 19 | protected $packageId = 32848; |
||
| 20 | |||
| 21 | protected $itemAppId = 440; |
||
| 22 | |||
| 23 | protected $groupId = 103582791429521412; |
||
| 24 | |||
| 25 | protected $groupName = 'Valve'; |
||
| 26 | |||
| 27 | protected $steamClient; |
||
| 28 | |||
| 29 | protected function setUp(): void |
||
| 30 | { |
||
| 31 | parent::setUp(); |
||
| 32 | |||
| 33 | $root = dirname(__DIR__, 1); |
||
| 34 | |||
| 35 | // Use .env when available |
||
| 36 | if (file_exists($root . '/.env')) { |
||
| 37 | $dotenv = Dotenv::createUnsafeImmutable($root); |
||
| 38 | $dotenv->load(); |
||
| 39 | } |
||
| 40 | |||
| 41 | $this->steamClient = new Client(); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** @test */ |
||
| 45 | public function empty_test() |
||
| 46 | { |
||
| 47 | $this->assertTrue(true); |
||
| 48 | } |
||
| 49 | |||
| 50 | protected function assertObjectHasAttributes($attributes, $object) |
||
| 51 | { |
||
| 52 | foreach ($attributes as $attribute) { |
||
| 53 | $this->assertObjectHasAttribute($attribute, $object); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | protected function checkSteamIdsProperties($steamId) |
||
| 58 | { |
||
| 59 | $attributes = [ |
||
| 60 | 'id32', 'id64', 'id3', 'communityId', 'steamId' |
||
| 61 | ]; |
||
| 62 | $this->assertObjectHasAttributes($attributes, $steamId); |
||
| 63 | } |
||
| 64 | |||
| 65 | protected function checkPlayerProperties($friendsList) |
||
| 66 | { |
||
| 67 | $attributes = [ |
||
| 68 | 'steamId', 'steamIds', 'communityVisibilityState', 'profileState', 'lastLogoff', 'profileUrl', 'realName', 'primaryClanId', 'timecreated' |
||
| 69 | ]; |
||
| 70 | $this->assertObjectHasAttributes($attributes, $friendsList[0]); |
||
| 71 | |||
| 72 | $attributes = [ |
||
| 73 | 'avatar', 'avatarMedium', 'avatarFull', 'avatarUrl', 'avatarMediumUrl', 'avatarFullUrl', |
||
| 74 | ]; |
||
| 75 | $this->assertObjectHasAttributes($attributes, $friendsList[0]); |
||
| 76 | |||
| 77 | $attributes = [ |
||
| 78 | 'personaName', 'personaState', 'personaStateId', 'personaStateFlags' |
||
| 79 | ]; |
||
| 80 | $this->assertObjectHasAttributes($attributes, $friendsList[0]); |
||
| 81 | |||
| 82 | $attributes = [ |
||
| 83 | 'locCountryCode', 'locStateCode', 'locCityId', 'location' |
||
| 84 | ]; |
||
| 85 | $this->assertObjectHasAttributes($attributes, $friendsList[0]); |
||
| 86 | |||
| 87 | $this->checkSteamIdsProperties($friendsList[0]->steamIds); |
||
| 88 | } |
||
| 89 | |||
| 90 | protected function checkAchievementProperties($achievement) |
||
| 91 | { |
||
| 92 | $attributes = [ |
||
| 93 | 'apiName', 'achieved', 'name', 'description' |
||
| 94 | ]; |
||
| 95 | $this->assertObjectHasAttributes($attributes, $achievement); |
||
| 96 | } |
||
| 97 | |||
| 98 | protected function checkAppProperties($app) |
||
| 99 | { |
||
| 100 | $this->checkMainAppProperties($app); |
||
| 101 | $this->checkGeneralAppProperties($app); |
||
| 102 | $this->checkNestedAppProperties($app); |
||
| 103 | } |
||
| 104 | |||
| 105 | protected function checkPackageProperties($package) |
||
| 106 | { |
||
| 107 | $this->checkNestedPackageProperties($package); |
||
| 108 | } |
||
| 109 | |||
| 110 | protected function checkGroupProperties($group) |
||
| 111 | { |
||
| 112 | $this->checkGroupMainSummaryProperties($group); |
||
| 113 | $this->checkGroupDetailProperties($group); |
||
| 114 | $this->checkGroupMemberDetailsProperties($group); |
||
| 115 | $this->checkGroupMemberProperties($group); |
||
| 116 | } |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @param $item |
||
| 120 | */ |
||
| 121 | protected function checkItemProperties($item) |
||
| 122 | { |
||
| 123 | $attributes = ['id', 'originalId', 'level', 'quality', 'quantity']; |
||
| 124 | $this->assertObjectHasAttributes($attributes, $item); |
||
| 125 | } |
||
| 126 | |||
| 127 | /** |
||
| 128 | * @param $app |
||
| 129 | */ |
||
| 130 | private function checkMainAppProperties($app) |
||
| 131 | { |
||
| 132 | $attributes = [ |
||
| 133 | 'id', 'type', 'name', 'controllerSupport', 'description', 'about', 'fullgame', 'header', 'website', 'shortDescription' |
||
| 134 | ]; |
||
| 135 | $this->assertObjectHasAttributes($attributes, $app); |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @param $app |
||
| 140 | */ |
||
| 141 | private function checkGeneralAppProperties($app) |
||
| 142 | { |
||
| 143 | $attributes = [ |
||
| 144 | 'pcRequirements', 'legal', 'developers', 'publishers', 'price', 'platforms', 'metacritic', 'categories', 'genres', 'release', 'requiredAge', 'isFree', 'supportedLanguages', 'recommendations' |
||
| 145 | ]; |
||
| 146 | $this->assertObjectHasAttributes($attributes, $app); |
||
| 147 | } |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @param $app |
||
| 151 | */ |
||
| 152 | private function checkNestedAppProperties($app) |
||
| 153 | { |
||
| 154 | $this->assertObjectHasAttribute('minimum', $app->pcRequirements); |
||
| 155 | |||
| 156 | $attributes = ['currency', 'initial', 'final', 'discount_percent']; |
||
| 157 | $this->assertObjectHasAttributes($attributes, $app->price); |
||
| 158 | |||
| 159 | $attributes = ['windows', 'mac', 'linux']; |
||
| 160 | $this->assertObjectHasAttributes($attributes, $app->platforms); |
||
| 161 | |||
| 162 | $attributes = ['score', 'url']; |
||
| 163 | $this->assertObjectHasAttributes($attributes, $app->metacritic); |
||
| 164 | |||
| 165 | $attributes = ['total']; |
||
| 166 | $this->assertObjectHasAttributes($attributes, $app->recommendations); |
||
| 167 | |||
| 168 | $attributes = ['total']; |
||
| 169 | $this->assertObjectHasAttributes($attributes, $app->achievements); |
||
| 170 | } |
||
| 171 | |||
| 172 | /** |
||
| 173 | * @param $package |
||
| 174 | */ |
||
| 175 | private function checkNestedPackageProperties($package) |
||
| 176 | { |
||
| 177 | $attributes = ['currency', 'initial', 'final', 'discount_percent', 'individual']; |
||
| 178 | $this->assertObjectHasAttributes($attributes, $package->price); |
||
| 179 | |||
| 180 | $attributes = ['windows', 'mac', 'linux']; |
||
| 181 | $this->assertObjectHasAttributes($attributes, $package->platforms); |
||
| 182 | } |
||
| 183 | |||
| 184 | /** |
||
| 185 | * @param $group |
||
| 186 | */ |
||
| 187 | private function checkGroupMainSummaryProperties($group) |
||
| 188 | { |
||
| 189 | $this->assertObjectHasAttribute('groupID64', $group); |
||
| 190 | $this->assertObjectHasAttribute('groupDetails', $group); |
||
| 191 | $this->assertObjectHasAttribute('memberDetails', $group); |
||
| 192 | $this->assertObjectHasAttribute('startingMember', $group); |
||
| 193 | $this->assertObjectHasAttribute('members', $group); |
||
| 194 | } |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @param $group |
||
| 198 | */ |
||
| 199 | private function checkGroupDetailProperties($group) |
||
| 200 | { |
||
| 201 | $this->assertObjectHasAttribute('name', $group->groupDetails); |
||
| 202 | $this->assertObjectHasAttribute('url', $group->groupDetails); |
||
| 203 | $this->assertObjectHasAttribute('headline', $group->groupDetails); |
||
| 204 | $this->assertObjectHasAttribute('summary', $group->groupDetails); |
||
| 205 | $this->assertObjectHasAttribute('avatarIcon', $group->groupDetails); |
||
| 206 | $this->assertObjectHasAttribute('avatarMedium', $group->groupDetails); |
||
| 207 | $this->assertObjectHasAttribute('avatarFull', $group->groupDetails); |
||
| 208 | $this->assertObjectHasAttribute('avatarIconUrl', $group->groupDetails); |
||
| 209 | $this->assertObjectHasAttribute('avatarMediumUrl', $group->groupDetails); |
||
| 210 | $this->assertObjectHasAttribute('avatarFullUrl', $group->groupDetails); |
||
| 211 | } |
||
| 212 | |||
| 213 | /** |
||
| 214 | * @param $group |
||
| 215 | */ |
||
| 216 | private function checkGroupMemberDetailsProperties($group) |
||
| 217 | { |
||
| 218 | $this->assertObjectHasAttribute('count', $group->memberDetails); |
||
| 219 | $this->assertObjectHasAttribute('inChat', $group->memberDetails); |
||
| 220 | $this->assertObjectHasAttribute('inGame', $group->memberDetails); |
||
| 221 | $this->assertObjectHasAttribute('online', $group->memberDetails); |
||
| 222 | } |
||
| 223 | |||
| 224 | /** |
||
| 225 | * @param $group |
||
| 226 | */ |
||
| 227 | private function checkGroupMemberProperties($group) |
||
| 228 | { |
||
| 229 | $startingMember = $group->members->get($group->startingMember); |
||
| 230 | |||
| 231 | $this->assertObjectHasAttribute('id32', $startingMember); |
||
| 232 | $this->assertObjectHasAttribute('id64', $startingMember); |
||
| 233 | $this->assertObjectHasAttribute('id3', $startingMember); |
||
| 234 | } |
||
| 235 | |||
| 236 | } |
||
| 237 |