Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Failed Conditions
Pull Request — master (#1082)
by Dan
05:43
created

UserRankingTest::test_getAllNames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php declare(strict_types=1);
2
3
namespace SmrTest\lib\DefaultGame;
4
5
use Smr\UserRanking;
6
7
/**
8
 * @covers Smr\UserRanking
9
 */
10
class UserRankingTest extends \PHPUnit\Framework\TestCase {
11
12
	public function test_getName() {
13
		$this->assertSame('Expert', UserRanking::getName(6));
14
	}
15
16
	public function test_getAllNames() {
17
		$this->assertSame('Expert', UserRanking::getAllNames()[6]);
18
	}
19
20
	public function test_rank_limits() {
21
		$ranks = array_keys(UserRanking::getAllNames());
22
		$this->assertSame(UserRanking::MIN_RANK, min($ranks));
23
		$this->assertSame(UserRanking::MAX_RANK, max($ranks));
24
	}
25
26
	public function test_score_limits() {
27
		// test the lowest possible score
28
		$rank = UserRanking::getRankFromScore(0);
29
		$this->assertSame(UserRanking::MIN_RANK, $rank);
30
		// test an absurdly high score
31
		$rank = UserRanking::getRankFromScore(PHP_INT_MAX);
32
		$this->assertSame(UserRanking::MAX_RANK, $rank);
33
	}
34
35
	public function test_getMinScoreForRank() {
36
		// test all ranks
37
		foreach (UserRanking::getAllNames() as $rank => $name) {
38
			$minScore = UserRanking::getMinScoreForRank($rank);
39
			// make sure the given min score is still the same rank
40
			$rankFromScore = UserRanking::getRankFromScore($minScore);
41
			$this->assertSame($rank, $rankFromScore);
42
		}
43
	}
44
45
}
46