mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
upload framework
This commit is contained in:
parent
754b1ce108
commit
a1a9504f11
30 changed files with 1578 additions and 155 deletions
52
tests/Providers/UserProviderTest.php
Normal file
52
tests/Providers/UserProviderTest.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php namespace Demostf\API\Test\Providers;
|
||||
|
||||
use Demostf\API\Providers\UserProvider;
|
||||
use Demostf\API\Test\TestCase;
|
||||
|
||||
class UserProviderTest extends TestCase {
|
||||
/** @var UserProvider */
|
||||
private $provider;
|
||||
|
||||
/** @var \SteamId */
|
||||
private $steamId;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->steamId = new \SteamId('76561198024494988');
|
||||
$this->provider = new UserProvider($this->getDatabaseConnection(), $this->getRandomGenerator());
|
||||
}
|
||||
|
||||
public function testGetNonExisting() {
|
||||
$this->assertFalse($this->provider->get('76561198024494988'));
|
||||
}
|
||||
|
||||
public function testStoreRetrieve() {
|
||||
$this->provider->store($this->steamId);
|
||||
|
||||
$user = $this->provider->get('76561198024494988');
|
||||
|
||||
$this->assertEquals($this->steamId->getNickname(), $user['name']);
|
||||
$this->assertEquals($this->steamId->getSteamId64(), '76561198024494988');
|
||||
}
|
||||
|
||||
public function testDoubleInsert() {
|
||||
$this->provider->store($this->steamId);
|
||||
$this->provider->store($this->steamId);
|
||||
}
|
||||
|
||||
public function testByKey() {
|
||||
$this->provider->store($this->steamId);
|
||||
|
||||
$user = $this->provider->get('76561198024494988');
|
||||
|
||||
$byKey = $this->provider->byKey($user['token']);
|
||||
$this->assertEquals('76561198024494988', $byKey['steamid']);
|
||||
}
|
||||
|
||||
public function testSearch() {
|
||||
$result = $this->provider->search('__NOT__FOUND__');
|
||||
|
||||
$this->assertCount(0, $result);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue