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