Completed
Push — master ( 84309c...24e320 )
by Vincenzo
02:46
created

testAllTheModulesGot11Players()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 13
rs 9.4285
cc 3
eloc 9
nc 3
nop 0
1
<?php
2
3
4
/**
5
 * Class ModuleConfigurationTest
6
 */
7
class ModuleConfigurationTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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', "api/");
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $modules is correct as \App\Lib\Helpers\Config:...dules.modules', 'api/') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
18
		$this->assertNotEmpty($modules);
19
		foreach ($modules as $key => $module) {
0 ignored issues
show
Bug introduced by
The expression $modules of type null is not traversable.
Loading history...
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', "api/");
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $modules is correct as \App\Lib\Helpers\Config:...dules.modules', 'api/') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
36
		$this->assertNotEmpty($modules);
37
		$roles = \App\Lib\Helpers\Config::get('modules.roles', "api/");
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $roles is correct as \App\Lib\Helpers\Config:...modules.roles', 'api/') (which targets App\Lib\Helpers\Config::get()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
38
		$rolesKeys = array_keys($roles);
39
40
		foreach ($modules as $key => $module) {
0 ignored issues
show
Bug introduced by
The expression $modules of type null is not traversable.
Loading history...
41
			echo "\nto play $key\n";
42
			$this->assertNotEmpty($module["roles"]);
43
			foreach ($module["roles"] as $index => $playNum) {
44
				if ($playNum != 0)
45
					echo $playNum . " " . $roles[$rolesKeys[$index]]["description"] . " ";
46
			}
47
		}
48
	}
49
50
	/**
51
	 * @group rand
52
	 *
53
	 */
54
	public function testRandomizer()
55
	{
56
		$yes = 0;
57
		$no = 0;
58
		echo "\n";
59
60
		for ($i = 1; $i <= 100; $i++) {
61
			echo $i . " . ";
62
			if (\App\Lib\DsManager\Helpers\Randomizer::boolOnPercentage(20)) {
63
				echo "yes";
64
				$yes++;
65
			} else {
66
				echo "nope";
67
				$no++;
68
			}
69
			echo "\n $yes - $no\n";
70
		}
71
72
	}
73
74
	/**
75
	 * @group randFiller
76
	 *
77
	 */
78
	public function testRandomFiller()
79
	{
80
		$rndF = new \App\Lib\DsManager\Helpers\RandomFiller();
81
		echo "\n";
82
		for ($i = 1; $i <= 10; $i++) {
83
			echo $rndF->getLocale();
84
			echo "\n";
85
		}
86
		echo "\n";
87
	}
88
89
}
90