1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
/**
|
5
|
|
|
* Class ModuleConfigurationTest
|
6
|
|
|
*/
|
7
|
|
|
class ModuleConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
8
|
|
|
{
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/**
|
12
|
|
|
* @group Modules
|
13
|
|
|
* @group config
|
14
|
|
|
*/
|
15
|
|
|
public function testAllTheModulesGot11Players()
|
16
|
|
|
{
|
17
|
|
|
$modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
|
|
|
18
|
|
|
$this->assertNotEmpty($modules);
|
19
|
|
|
foreach ($modules as $key => $module) {
|
|
|
|
|
20
|
|
|
$this->assertNotEmpty($module["roles"]);
|
21
|
|
|
$count = 0;
|
22
|
|
|
foreach ($module["roles"] as $roleNum) {
|
23
|
|
|
$count += $roleNum;
|
24
|
|
|
}
|
25
|
|
|
$this->assertTrue(11 === $count, "Not correct Players for $key");
|
26
|
|
|
}
|
27
|
|
|
}
|
28
|
|
|
|
29
|
|
|
/**
|
30
|
|
|
* @group Roles
|
31
|
|
|
* @group config
|
32
|
|
|
*/
|
33
|
|
|
public function testCorrectDisplayModuleDescriptionRole()
|
34
|
|
|
{
|
35
|
|
|
$modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
|
|
|
36
|
|
|
$this->assertNotEmpty($modules);
|
37
|
|
|
$roles = \App\Lib\Helpers\Config::get('modules.roles');
|
|
|
|
|
38
|
|
|
$rolesKeys = array_keys($roles);
|
39
|
|
|
|
40
|
|
|
foreach ($modules as $key => $module) {
|
|
|
|
|
41
|
|
|
$this->assertNotEmpty($module["roles"]);
|
42
|
|
|
foreach ($module["roles"] as $index => $playNum) {
|
43
|
|
|
if ($playNum != 0) {
|
44
|
|
|
$this->assertGreaterThan(0, $playNum);
|
45
|
|
|
$this->assertNotNull($roles[$rolesKeys[$index]]["description"]);
|
46
|
|
|
}
|
47
|
|
|
}
|
48
|
|
|
}
|
49
|
|
|
}
|
50
|
|
|
|
51
|
|
|
/**
|
52
|
|
|
* @group rand
|
53
|
|
|
*
|
54
|
|
|
*/
|
55
|
|
|
public function testRandomizer()
|
56
|
|
|
{
|
57
|
|
|
$yes = 0;
|
58
|
|
|
$no = 0;
|
59
|
|
|
for ($i = 1; $i <= 100; $i++) {
|
60
|
|
|
if (\App\Lib\DsManager\Helpers\Randomizer::boolOnPercentage(20)) {
|
61
|
|
|
$yes++;
|
62
|
|
|
} else {
|
63
|
|
|
$no++;
|
64
|
|
|
}
|
65
|
|
|
}
|
66
|
|
|
$this->assertNotEmpty($yes);
|
67
|
|
|
$this->assertNotEmpty($no);
|
68
|
|
|
$this->assertGreaterThan($yes, $no);
|
69
|
|
|
}
|
70
|
|
|
|
71
|
|
|
/**
|
72
|
|
|
* @group randFiller
|
73
|
|
|
*
|
74
|
|
|
*/
|
75
|
|
|
public function testRandomFiller()
|
76
|
|
|
{
|
77
|
|
|
$rndF = new \App\Lib\DsManager\Helpers\RandomFiller();
|
78
|
|
|
for ($i = 1; $i <= 10; $i++) {
|
79
|
|
|
$this->assertNotEmpty($rndF->getLocale());
|
80
|
|
|
}
|
81
|
|
|
}
|
82
|
|
|
|
83
|
|
|
}
|
84
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.