| 148 |
lars |
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 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 |
interface LegacyMockInterface
|
|
|
24 |
{
|
|
|
25 |
/**
|
|
|
26 |
* Alternative setup method to constructor
|
|
|
27 |
*
|
|
|
28 |
* @param \Mockery\Container $container
|
|
|
29 |
* @param object $partialObject
|
|
|
30 |
* @return void
|
|
|
31 |
*/
|
|
|
32 |
public function mockery_init(\Mockery\Container $container = null, $partialObject = null);
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* Set expected method calls
|
|
|
36 |
*
|
|
|
37 |
* @param string|array ...$methodNames one or many methods that are expected to be called in this mock
|
|
|
38 |
*
|
|
|
39 |
* @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage
|
|
|
40 |
*/
|
|
|
41 |
public function shouldReceive(...$methodNames);
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Shortcut method for setting an expectation that a method should not be called.
|
|
|
45 |
*
|
|
|
46 |
* @param string|array ...$methodNames one or many methods that are expected not to be called in this mock
|
|
|
47 |
* @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage
|
|
|
48 |
*/
|
|
|
49 |
public function shouldNotReceive(...$methodNames);
|
|
|
50 |
|
|
|
51 |
/**
|
|
|
52 |
* Allows additional methods to be mocked that do not explicitly exist on mocked class
|
|
|
53 |
* @param String $method name of the method to be mocked
|
|
|
54 |
*/
|
|
|
55 |
public function shouldAllowMockingMethod($method);
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Set mock to ignore unexpected methods and return Undefined class
|
|
|
59 |
* @param mixed $returnValue the default return value for calls to missing functions on this mock
|
|
|
60 |
* @return Mock
|
|
|
61 |
*/
|
|
|
62 |
public function shouldIgnoreMissing($returnValue = null);
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* @return Mock
|
|
|
66 |
*/
|
|
|
67 |
public function shouldAllowMockingProtectedMethods();
|
|
|
68 |
|
|
|
69 |
/**
|
|
|
70 |
* Set mock to defer unexpected methods to its parent if possible
|
|
|
71 |
*
|
|
|
72 |
* @deprecated since 1.4.0. Please use makePartial() instead.
|
|
|
73 |
*
|
|
|
74 |
* @return Mock
|
|
|
75 |
*/
|
|
|
76 |
public function shouldDeferMissing();
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* Set mock to defer unexpected methods to its parent if possible
|
|
|
80 |
*
|
|
|
81 |
* @return Mock
|
|
|
82 |
*/
|
|
|
83 |
public function makePartial();
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* @param null|string $method
|
|
|
87 |
* @param null|array|Closure $args
|
|
|
88 |
* @return mixed
|
|
|
89 |
*/
|
|
|
90 |
public function shouldHaveReceived($method, $args = null);
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* @return mixed
|
|
|
94 |
*/
|
|
|
95 |
public function shouldHaveBeenCalled();
|
|
|
96 |
|
|
|
97 |
/**
|
|
|
98 |
* @param null|string $method
|
|
|
99 |
* @param null|array|Closure $args
|
|
|
100 |
* @return mixed
|
|
|
101 |
*/
|
|
|
102 |
public function shouldNotHaveReceived($method, $args = null);
|
|
|
103 |
|
|
|
104 |
/**
|
|
|
105 |
* @param array $args (optional)
|
|
|
106 |
* @return mixed
|
|
|
107 |
*/
|
|
|
108 |
public function shouldNotHaveBeenCalled(array $args = null);
|
|
|
109 |
|
|
|
110 |
/**
|
|
|
111 |
* In the event shouldReceive() accepting an array of methods/returns
|
|
|
112 |
* this method will switch them from normal expectations to default
|
|
|
113 |
* expectations
|
|
|
114 |
*
|
|
|
115 |
* @return self
|
|
|
116 |
*/
|
|
|
117 |
public function byDefault();
|
|
|
118 |
|
|
|
119 |
/**
|
|
|
120 |
* Iterate across all expectation directors and validate each
|
|
|
121 |
*
|
|
|
122 |
* @throws \Mockery\CountValidator\Exception
|
|
|
123 |
* @return void
|
|
|
124 |
*/
|
|
|
125 |
public function mockery_verify();
|
|
|
126 |
|
|
|
127 |
/**
|
|
|
128 |
* Tear down tasks for this mock
|
|
|
129 |
*
|
|
|
130 |
* @return void
|
|
|
131 |
*/
|
|
|
132 |
public function mockery_teardown();
|
|
|
133 |
|
|
|
134 |
/**
|
|
|
135 |
* Fetch the next available allocation order number
|
|
|
136 |
*
|
|
|
137 |
* @return int
|
|
|
138 |
*/
|
|
|
139 |
public function mockery_allocateOrder();
|
|
|
140 |
|
|
|
141 |
/**
|
|
|
142 |
* Set ordering for a group
|
|
|
143 |
*
|
|
|
144 |
* @param mixed $group
|
|
|
145 |
* @param int $order
|
|
|
146 |
*/
|
|
|
147 |
public function mockery_setGroup($group, $order);
|
|
|
148 |
|
|
|
149 |
/**
|
|
|
150 |
* Fetch array of ordered groups
|
|
|
151 |
*
|
|
|
152 |
* @return array
|
|
|
153 |
*/
|
|
|
154 |
public function mockery_getGroups();
|
|
|
155 |
|
|
|
156 |
/**
|
|
|
157 |
* Set current ordered number
|
|
|
158 |
*
|
|
|
159 |
* @param int $order
|
|
|
160 |
*/
|
|
|
161 |
public function mockery_setCurrentOrder($order);
|
|
|
162 |
|
|
|
163 |
/**
|
|
|
164 |
* Get current ordered number
|
|
|
165 |
*
|
|
|
166 |
* @return int
|
|
|
167 |
*/
|
|
|
168 |
public function mockery_getCurrentOrder();
|
|
|
169 |
|
|
|
170 |
/**
|
|
|
171 |
* Validate the current mock's ordering
|
|
|
172 |
*
|
|
|
173 |
* @param string $method
|
|
|
174 |
* @param int $order
|
|
|
175 |
* @throws \Mockery\Exception
|
|
|
176 |
* @return void
|
|
|
177 |
*/
|
|
|
178 |
public function mockery_validateOrder($method, $order);
|
|
|
179 |
|
|
|
180 |
/**
|
|
|
181 |
* Gets the count of expectations for this mock
|
|
|
182 |
*
|
|
|
183 |
* @return int
|
|
|
184 |
*/
|
|
|
185 |
public function mockery_getExpectationCount();
|
|
|
186 |
|
|
|
187 |
/**
|
|
|
188 |
* Return the expectations director for the given method
|
|
|
189 |
*
|
|
|
190 |
* @var string $method
|
|
|
191 |
* @return \Mockery\ExpectationDirector|null
|
|
|
192 |
*/
|
|
|
193 |
public function mockery_setExpectationsFor($method, \Mockery\ExpectationDirector $director);
|
|
|
194 |
|
|
|
195 |
/**
|
|
|
196 |
* Return the expectations director for the given method
|
|
|
197 |
*
|
|
|
198 |
* @var string $method
|
|
|
199 |
* @return \Mockery\ExpectationDirector|null
|
|
|
200 |
*/
|
|
|
201 |
public function mockery_getExpectationsFor($method);
|
|
|
202 |
|
|
|
203 |
/**
|
|
|
204 |
* Find an expectation matching the given method and arguments
|
|
|
205 |
*
|
|
|
206 |
* @var string $method
|
|
|
207 |
* @var array $args
|
|
|
208 |
* @return \Mockery\Expectation|null
|
|
|
209 |
*/
|
|
|
210 |
public function mockery_findExpectation($method, array $args);
|
|
|
211 |
|
|
|
212 |
/**
|
|
|
213 |
* Return the container for this mock
|
|
|
214 |
*
|
|
|
215 |
* @return \Mockery\Container
|
|
|
216 |
*/
|
|
|
217 |
public function mockery_getContainer();
|
|
|
218 |
|
|
|
219 |
/**
|
|
|
220 |
* Return the name for this mock
|
|
|
221 |
*
|
|
|
222 |
* @return string
|
|
|
223 |
*/
|
|
|
224 |
public function mockery_getName();
|
|
|
225 |
|
|
|
226 |
/**
|
|
|
227 |
* @return array
|
|
|
228 |
*/
|
|
|
229 |
public function mockery_getMockableProperties();
|
|
|
230 |
|
|
|
231 |
/**
|
|
|
232 |
* @return string[]
|
|
|
233 |
*/
|
|
|
234 |
public function mockery_getMockableMethods();
|
|
|
235 |
|
|
|
236 |
/**
|
|
|
237 |
* @return bool
|
|
|
238 |
*/
|
|
|
239 |
public function mockery_isAnonymous();
|
|
|
240 |
}
|