2 PHPUnit_Framework_MockObject_Generator::generate('Foo', array('bar'), 'MockFoo', TRUE, TRUE)
7 public function bar(Foo $foo)
11 public function baz(Foo $foo)
16 require_once 'PHPUnit/Autoload.php';
17 require_once 'Text/Template.php';
19 $mock = PHPUnit_Framework_MockObject_Generator::generate(
30 class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
32 private static $__phpunit_staticInvocationMocker;
33 private $__phpunit_invocationMocker;
35 public function __clone()
37 $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
40 public function bar(Foo $foo)
42 $arguments = array($foo);
43 $count = func_num_args();
46 $_arguments = func_get_args();
48 for ($i = 1; $i < $count; $i++) {
49 $arguments[] = $_arguments[$i];
53 $result = $this->__phpunit_getInvocationMocker()->invoke(
54 new PHPUnit_Framework_MockObject_Invocation_Object(
55 'Foo', 'bar', $arguments, $this, TRUE
62 public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
64 return $this->__phpunit_getInvocationMocker()->expects($matcher);
67 public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
69 return self::__phpunit_getStaticInvocationMocker()->expects($matcher);
72 public function __phpunit_getInvocationMocker()
74 if ($this->__phpunit_invocationMocker === NULL) {
75 $this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
78 return $this->__phpunit_invocationMocker;
81 public static function __phpunit_getStaticInvocationMocker()
83 if (self::$__phpunit_staticInvocationMocker === NULL) {
84 self::$__phpunit_staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
87 return self::$__phpunit_staticInvocationMocker;
90 public function __phpunit_hasMatchers()
92 return self::__phpunit_getStaticInvocationMocker()->hasMatchers() ||
93 $this->__phpunit_getInvocationMocker()->hasMatchers();
96 public function __phpunit_verify()
98 self::__phpunit_getStaticInvocationMocker()->verify();
99 $this->__phpunit_getInvocationMocker()->verify();
102 public function __phpunit_cleanup()
104 self::$__phpunit_staticInvocationMocker = NULL;
105 $this->__phpunit_invocationMocker = NULL;