Permalink
Browse files

Community URL trailing slash tests.

  • Loading branch information...
mukunda- committed Sep 21, 2015
1 parent 2875851 commit 948a7cf0909b5c7f1155fbcc06a8dfc0e1b8cbbe
Showing with 27 additions and 0 deletions.
  1. +27 −0 test.php
View
@@ -142,14 +142,25 @@ public static function Add( $name, $method ) {
$steamid = SteamID::Parse( "http://www.steamcommunity.com/profiles/76561198069264171" );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "community URL 1 Trailing Slashes" );
$steamid = SteamID::Parse( "http://www.steamcommunity.com/profiles/76561198069264171/" );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
$steamid = SteamID::Parse( "http://www.steamcommunity.com/profiles/76561198069264171//////" );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "community URL 2" );
$steamid = SteamID::Parse( "http://steamcommunity.com/profiles/76561198069264171" );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "community URL 3" );
$steamid = SteamID::Parse( "www.steamcommunity.com/profiles/76561198069264171" );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "community URL 4" );
$steamid = SteamID::Parse( "steamcommunity.com/profiles/76561198069264171" );
if( $steamid === FALSE ) return FALSE;
@@ -224,12 +235,28 @@ function VanityTest() {
}
return $name;
};
PrintSubTest( "simple/direct" );
$steamid = SteamID::Parse( "prayspray", SteamID::FORMAT_AUTO, true );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "fullurl" );
$steamid = SteamID::Parse( "http://steamcommunity.com/id/prayspray", SteamID::FORMAT_AUTO, true );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "fullurl with trailing slash" );
$steamid = SteamID::Parse( "http://steamcommunity.com/id/prayspray/", SteamID::FORMAT_AUTO, true );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "fullurl with trailing slashes" );
$steamid = SteamID::Parse( "http://steamcommunity.com/id/prayspray/////", SteamID::FORMAT_AUTO, true );
if( $steamid === FALSE ) return FALSE;
if( $steamid->Format( SteamID::FORMAT_STEAMID32 ) != "STEAM_1:1:54499221" ) return FALSE;
PrintSubTest( "random strings" );
for( $i = 0; $i < 20; $i++ ) {
$name = $buildname( $i );

0 comments on commit 948a7cf

Please sign in to comment.