2
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE, TRUE)
7
public function bar(Foo $foo)
11
public function baz(Foo $foo)
16
require __DIR__ . '/../../vendor/autoload.php';
18
$generator = new PHPUnit_Framework_MockObject_Generator;
20
$mock = $generator->generate(
32
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
34
private $__phpunit_invocationMocker;
35
private $__phpunit_originalObject;
37
public function __clone()
39
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
42
public function bar(Foo $foo)
44
$arguments = array($foo);
45
$count = func_num_args();
48
$_arguments = func_get_args();
50
for ($i = 1; $i < $count; $i++) {
51
$arguments[] = $_arguments[$i];
55
$result = $this->__phpunit_getInvocationMocker()->invoke(
56
new PHPUnit_Framework_MockObject_Invocation_Object(
57
'Foo', 'bar', $arguments, $this, TRUE
64
public function baz(Foo $foo)
66
$arguments = array($foo);
67
$count = func_num_args();
70
$_arguments = func_get_args();
72
for ($i = 1; $i < $count; $i++) {
73
$arguments[] = $_arguments[$i];
77
$result = $this->__phpunit_getInvocationMocker()->invoke(
78
new PHPUnit_Framework_MockObject_Invocation_Object(
79
'Foo', 'baz', $arguments, $this, TRUE
86
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
88
return $this->__phpunit_getInvocationMocker()->expects($matcher);
91
public function method()
93
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
94
$expects = $this->expects($any);
95
return call_user_func_array(array($expects, 'method'), func_get_args());
98
public function __phpunit_setOriginalObject($originalObject)
100
$this->__phpunit_originalObject = $originalObject;
103
public function __phpunit_getInvocationMocker()
105
if ($this->__phpunit_invocationMocker === NULL) {
106
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
109
return $this->__phpunit_invocationMocker;
112
public function __phpunit_hasMatchers()
114
return $this->__phpunit_getInvocationMocker()->hasMatchers();
117
public function __phpunit_verify()
119
$this->__phpunit_getInvocationMocker()->verify();
120
$this->__phpunit_invocationMocker = NULL;