コード例 #1
0
ファイル: .test.php プロジェクト: angry-cookies/SteamID.php
 public function testSteam3CorrectInvalidParse()
 {
     $s = new SteamID('[i:1:123]');
     $this->assertEquals(123, $s->GetAccountID());
     $this->assertEquals(SteamID::TypeInvalid, $s->GetAccountType());
 }
コード例 #2
0
ファイル: .test.php プロジェクト: jenky/SteamID.php
 public function testSteam3CorrectParse()
 {
     $s = new SteamID('[U:1:123]');
     $this->assertTrue($s->IsValid());
     $this->assertEquals(123, $s->GetAccountID());
     $this->assertEquals(SteamID::DesktopInstance, $s->GetAccountInstance());
     $this->assertEquals(SteamID::UniversePublic, $s->GetAccountUniverse());
     $this->assertEquals(SteamID::TypeIndividual, $s->GetAccountType());
     $s->SetAccountInstance(1337);
     $this->assertEquals(1337, $s->GetAccountInstance());
     $this->assertFalse($s->IsValid());
     $s = new SteamID('[A:1:123:456]');
     $this->assertTrue($s->IsValid());
     $this->assertEquals(123, $s->GetAccountID());
     $this->assertEquals(456, $s->GetAccountInstance());
     $this->assertEquals(SteamID::UniversePublic, $s->GetAccountUniverse());
     $this->assertEquals(SteamID::TypeAnonGameServer, $s->GetAccountType());
     $s = new SteamID('[L:2:123]');
     $this->assertTrue($s->IsValid());
     $this->assertEquals(123, $s->GetAccountID());
     $this->assertTrue(!!($s->GetAccountInstance() & SteamID::InstanceFlagLobby));
     $this->assertEquals(SteamID::UniverseBeta, $s->GetAccountUniverse());
     $this->assertEquals(SteamID::TypeChat, $s->GetAccountType());
     $s = new SteamID('[c:3:123]');
     $this->assertTrue($s->IsValid());
     $this->assertEquals(123, $s->GetAccountID());
     $this->assertTrue(!!($s->GetAccountInstance() & SteamID::InstanceFlagClan));
     $this->assertEquals(SteamID::UniverseInternal, $s->GetAccountUniverse());
     $this->assertEquals(SteamID::TypeChat, $s->GetAccountType());
     $s = new SteamID('[g:1:456]');
     $s->SetAccountInstance(1337);
     $s->SetAccountID(0);
     $this->assertFalse($s->IsValid());
     $this->assertEquals(0, $s->GetAccountID());
     $this->assertEquals(SteamID::UniversePublic, $s->GetAccountUniverse());
     $this->assertEquals(SteamID::TypeClan, $s->GetAccountType());
     $s = new SteamID('[G:4:1]');
     $this->assertTrue($s->IsValid());
     $s->SetAccountID(0);
     $this->assertFalse($s->IsValid());
     $this->assertEquals(0, $s->GetAccountID());
     $this->assertEquals(SteamID::UniverseDev, $s->GetAccountUniverse());
     $this->assertEquals(SteamID::TypeGameServer, $s->GetAccountType());
     $s->SetAccountType(15);
     $this->assertFalse($s->IsValid());
     $this->assertEquals(15, $s->GetAccountType());
 }