| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 0.00% covered (danger) | 0.00% | 0 / 1 | 25.00% covered (danger) | 25.00% | 3 / 12 | CRAP | 41.67% covered (danger) | 41.67% | 15 / 36
MockConfigurationBuilder | 0.00% covered (danger) | 0.00% | 0 / 1 | 25.00% covered (danger) | 25.00% | 3 / 12 | 59.66 | 41.67% covered (danger) | 41.67% | 15 / 36
addTarget($target) | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 2 / 2
addTargets($targets) | 0.00% covered (danger) | 0.00% | 0 / 1 | 6 | 0.00% covered (danger) | 0.00% | 0 / 4
setName($name) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
addBlackListedMethod($blackListedMethod) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
addBlackListedMethods(array $blackListedMethods) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.06 | 75.00% covered (warning) | 75.00% | 3 / 4
setBlackListedMethods(array $blackListedMethods) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
addWhiteListedMethod($whiteListedMethod) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
addWhiteListedMethods(array $whiteListedMethods) | 0.00% covered (danger) | 0.00% | 0 / 1 | 6 | 0.00% covered (danger) | 0.00% | 0 / 4
setWhiteListedMethods(array $whiteListedMethods) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
setInstanceMock($instanceMock) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
setParameterOverrides(array $overrides) | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 2 / 2
getMockConfiguration() | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 8 / 8

1 | <?php
2 |
3 | namespace Mockery\Generator;
4 |
5 | class MockConfigurationBuilder
6 | {
7 | protected $name;
8 | protected $blackListedMethods = array(
9 | '__call',
10 | '__callStatic',
11 | '__clone',
12 | '__wakeup',
13 | '__set',
14 | '__get',
15 | '__toString',
16 | '__isset',
17 | '__destruct',
18 |
19 | // below are reserved words in PHP
20 | "__halt_compiler", "abstract", "and", "array", "as",
21 | "break", "callable", "case", "catch", "class",
22 | "clone", "const", "continue", "declare", "default",
23 | "die", "do", "echo", "else", "elseif",
24 | "empty", "enddeclare", "endfor", "endforeach", "endif",
25 | "endswitch", "endwhile", "eval", "exit", "extends",
26 | "final", "for", "foreach", "function", "global",
27 | "goto", "if", "implements", "include", "include_once",
28 | "instanceof", "insteadof", "interface", "isset", "list",
29 | "namespace", "new", "or", "print", "private",
30 | "protected", "public", "require", "require_once", "return",
31 | "static", "switch", "throw", "trait", "try",
32 | "unset", "use", "var", "while", "xor"
33 | );
34 | protected $whiteListedMethods = array();
35 | protected $instanceMock = false;
36 | protected $parameterOverrides = array();
37 |
38 | protected $targets = array();
39 |
40 | public function addTarget($target)
41 | {
42 | $this->targets[] = $target;
43 |
44 | return $this;
45 | }
46 |
47 | public function addTargets($targets)
48 | {
49 | foreach ($targets as $target) {
50 | $this->addTarget($target);
51 | }
52 |
53 | return $this;
54 | }
55 |
56 | public function setName($name)
57 | {
58 | $this->name = $name;
59 | return $this;
60 | }
61 |
62 | public function addBlackListedMethod($blackListedMethod)
63 | {
64 | $this->blackListedMethods[] = $blackListedMethod;
65 | return $this;
66 | }
67 |
68 | public function addBlackListedMethods(array $blackListedMethods)
69 | {
70 | foreach ($blackListedMethods as $method) {
71 | $this->addBlackListedMethod($method);
72 | }
73 | return $this;
74 | }
75 |
76 | public function setBlackListedMethods(array $blackListedMethods)
77 | {
78 | $this->blackListedMethods = $blackListedMethods;
79 | return $this;
80 | }
81 |
82 | public function addWhiteListedMethod($whiteListedMethod)
83 | {
84 | $this->whiteListedMethods[] = $whiteListedMethod;
85 | return $this;
86 | }
87 |
88 | public function addWhiteListedMethods(array $whiteListedMethods)
89 | {
90 | foreach ($whiteListedMethods as $method) {
91 | $this->addWhiteListedMethod($method);
92 | }
93 | return $this;
94 | }
95 |
96 | public function setWhiteListedMethods(array $whiteListedMethods)
97 | {
98 | $this->whiteListedMethods = $whiteListedMethods;
99 | return $this;
100 | }
101 |
102 | public function setInstanceMock($instanceMock)
103 | {
104 | $this->instanceMock = (bool) $instanceMock;
105 | }
106 |
107 | public function setParameterOverrides(array $overrides)
108 | {
109 | $this->parameterOverrides = $overrides;
110 | }
111 |
112 | public function getMockConfiguration()
113 | {
114 | return new MockConfiguration(
115 | $this->targets,
116 | $this->blackListedMethods,
117 | $this->whiteListedMethods,
118 | $this->name,
119 | $this->instanceMock,
120 | $this->parameterOverrides
121 | );
122 | }
123 |
124 | }