1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-03 18:04:08 +02:00

filter by backend

This commit is contained in:
Robin Appelman 2017-08-08 00:29:24 +02:00
commit df83a46e20
17 changed files with 265 additions and 38 deletions

View file

@ -153,13 +153,28 @@ class DemoListProviderTest extends TestCase {
$this->assertEquals($id2, $list[0]->getId());
$this->assertEquals($id1, $list[1]->getId());
$list = $this->demoListProvider->listDemos(1, ['players' => [$steamId1->getSteamId64(), $steamId3->getSteamId64()]]);
$list = $this->demoListProvider->listDemos(1,
['players' => [$steamId1->getSteamId64(), $steamId3->getSteamId64()]]);
$this->assertCount(1, $list);
$this->assertEquals($id2, $list[0]->getId());
$list = $this->demoListProvider->listDemos(1, ['players' => [$steamId2->getSteamId64(), $steamId3->getSteamId64()]]);
$list = $this->demoListProvider->listDemos(1,
['players' => [$steamId2->getSteamId64(), $steamId3->getSteamId64()]]);
$this->assertCount(0, $list);
}
public function testByUploaderFilterBackend() {
$steamId = $this->getSteamId('12345', 'bar');
$this->userProvider->store($steamId);
$userId = $this->userProvider->get($steamId->getSteamId64())->getId();
$id1 = $this->demoProvider->storeDemo($this->getDemo($userId, 'map1', 12), 'foo1', 'bar');
$id2 = $this->demoProvider->storeDemo($this->getDemo($userId, 'map2', 18), 'foo1', 'bar');
$id3 = $this->demoProvider->storeDemo($this->getDemo($userId + 1, 'map1', 12), 'foo2', 'bar');
$list = $this->demoListProvider->listUploads($steamId->getSteamId64(), 1, ['backend' => 'foo2']);
$this->assertEquals($id3, $list[0]->getId());
}
}