| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 0.00% covered (danger) | 0.00% | 0 / 1 | 25.00% covered (danger) | 25.00% | 2 / 8 | CRAP | 12.50% covered (danger) | 12.50% | 2 / 16
Configuration | 0.00% covered (danger) | 0.00% | 0 / 1 | 25.00% covered (danger) | 25.00% | 2 / 8 | 76.99 | 12.50% covered (danger) | 12.50% | 2 / 16
allowMockingNonExistentMethods($flag = true) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
mockingNonExistentMethodsAllowed() | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
allowMockingMethodsUnnecessarily($flag = true) | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
mockingMethodsUnnecessarilyAllowed() | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 1
setInternalClassMethodParamMap($class, $method, array $map) | 0.00% covered (danger) | 0.00% | 0 / 1 | 6 | 0.00% covered (danger) | 0.00% | 0 / 4
resetInternalClassMethodParamMaps() | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 | 0.00% covered (danger) | 0.00% | 0 / 2
getInternalClassMethodParamMap($class, $method) | 0.00% covered (danger) | 0.00% | 0 / 1 | 6 | 0.00% covered (danger) | 0.00% | 0 / 3
getInternalClassMethodParamMaps() | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1

1 | <?php
2 | /**
3 | * Mockery
4 | *
5 | * LICENSE
6 | *
7 | * This source file is subject to the new BSD license that is bundled
8 | * with this package in the file LICENSE.txt.
9 | * It is also available through the world-wide-web at this URL:
10 | * http://github.com/padraic/mockery/blob/master/LICENSE
11 | * If you did not receive a copy of the license and are unable to
12 | * obtain it through the world-wide-web, please send an email
13 | * to padraic@php.net so we can send you a copy immediately.
14 | *
15 | * @category Mockery
16 | * @package Mockery
17 | * @copyright Copyright (c) 2010-2014 Pádraic Brady (http://blog.astrumfutura.com)
18 | * @license http://github.com/padraic/mockery/blob/master/LICENSE New BSD License
19 | */
20 |
21 | namespace Mockery;
22 |
23 | class Configuration
24 | {
25 |
26 | /**
27 | * Boolean assertion of whether we can mock methods which do not actually
28 | * exist for the given class or object (ignored for unreal mocks)
29 | *
30 | * @var bool
31 | */
32 | protected $_allowMockingNonExistentMethod = true;
33 |
34 | /**
35 | * Boolean assertion of whether we ignore unnecessary mocking of methods,
36 | * i.e. when method expectations are made, set using a zeroOrMoreTimes()
37 | * constraint, and then never called. Essentially such expectations are
38 | * not required and are just taking up test space.
39 | *
40 | * @var bool
41 | */
42 | protected $_allowMockingMethodsUnnecessarily = true;
43 |
44 | /**
45 | * Parameter map for use with PHP internal classes.
46 | *
47 | * @var array
48 | */
49 | protected $_internalClassParamMap = array();
50 |
51 | /**
52 | * Set boolean to allow/prevent mocking of non-existent methods
53 | *
54 | * @param bool
55 | */
56 | public function allowMockingNonExistentMethods($flag = true)
57 | {
58 | $this->_allowMockingNonExistentMethod = (bool) $flag;
59 | }
60 |
61 | /**
62 | * Return flag indicating whether mocking non-existent methods allowed
63 | *
64 | * @return bool
65 | */
66 | public function mockingNonExistentMethodsAllowed()
67 | {
68 | return $this->_allowMockingNonExistentMethod;
69 | }
70 |
71 | /**
72 | * Set boolean to allow/prevent unnecessary mocking of methods
73 | *
74 | * @param bool
75 | */
76 | public function allowMockingMethodsUnnecessarily($flag = true)
77 | {
78 | $this->_allowMockingMethodsUnnecessarily = (bool) $flag;
79 | }
80 |
81 | /**
82 | * Return flag indicating whether mocking non-existent methods allowed
83 | *
84 | * @return bool
85 | */
86 | public function mockingMethodsUnnecessarilyAllowed()
87 | {
88 | return $this->_allowMockingMethodsUnnecessarily;
89 | }
90 |
91 | /**
92 | * Set a parameter map (array of param signature strings) for the method
93 | * of an internal PHP class.
94 | *
95 | * @param string $class
96 | * @param string $method
97 | * @param array $map
98 | */
99 | public function setInternalClassMethodParamMap($class, $method, array $map)
100 | {
101 | if (!isset($this->_internalClassParamMap[strtolower($class)])) {
102 | $this->_internalClassParamMap[strtolower($class)] = array();
103 | }
104 | $this->_internalClassParamMap[strtolower($class)][strtolower($method)] = $map;
105 | }
106 |
107 | /**
108 | * Remove all overriden parameter maps from internal PHP classes.
109 | */
110 | public function resetInternalClassMethodParamMaps()
111 | {
112 | $this->_internalClassParamMap = array();
113 | }
114 |
115 | /**
116 | * Get the parameter map of an internal PHP class method
117 | *
118 | * @return array
119 | */
120 | public function getInternalClassMethodParamMap($class, $method)
121 | {
122 | if (isset($this->_internalClassParamMap[strtolower($class)][strtolower($method)])) {
123 | return $this->_internalClassParamMap[strtolower($class)][strtolower($method)];
124 | }
125 | }
126 |
127 | public function getInternalClassMethodParamMaps()
128 | {
129 | return $this->_internalClassParamMap;
130 | }
131 |
132 | }