public function testResolveUnknownVanityUrl()
 {
     $webApi = $this->getMockBuilder('\\SteamCondenser\\Community\\WebApi')->setMethods(['_load'])->disableOriginalConstructor()->getMock();
     $webApi->expects($this->once())->method('_load')->with('json', 'ISteamUser', 'ResolveVanityURL', 1, ['vanityurl' => 'unknown'])->will($this->returnValue('{ "response": { "success": 42 } }'));
     $this->webApiInstance->setValue($webApi);
     $this->assertNull(SteamId::resolveVanityUrl('unknown'));
 }
 /**
  * This checks the cache for an existing inventory. If it exists it is
  * returned. Otherwise a new inventory is created.
  *
  * @param int $appId The application ID of the game
  * @param string $steamId The 64bit Steam ID or the vanity URL of the user
  * @param bool $fetchNow Whether the data should be fetched now
  * @param bool $bypassCache Whether the cache should be bypassed
  * @return GameInventory
  */
 public static function create($appId, $steamId, $fetchNow = true, $bypassCache = false)
 {
     if (is_numeric($steamId)) {
         $steamId64 = $steamId;
     } else {
         $steamId64 = SteamId::resolveVanityUrl($steamId);
     }
     if (self::isCached($appId, $steamId64) && !$bypassCache) {
         $inventory = self::$cache[$appId][$steamId64];
         if ($fetchNow && !$inventory->isFetched()) {
             $inventory->fetch();
         }
         return $inventory;
     } else {
         switch ($appId) {
             case Dota2BetaInventory::APP_ID:
                 $inventoryClass = 'Dota2BetaInventory';
                 break;
             case Dota2Inventory::APP_ID:
                 $inventoryClass = 'Dota2Inventory';
                 break;
             case Portal2Inventory::APP_ID:
                 $inventoryClass = 'Portal2Inventory';
                 break;
             case TF2BetaInventory::APP_ID:
                 $inventoryClass = 'TF2BetaInventory';
                 break;
             case TF2Inventory::APP_ID:
                 $inventoryClass = 'TF2Inventory';
                 break;
             default:
                 $inventoryClass = 'GameInventory';
         }
         return new $inventoryClass($appId, $steamId64, $fetchNow);
     }
 }