1--TEST-- 2PHPUnit_Framework_MockObject_Generator::generate('NonExistentClass', array(), 'MockFoo', true, true) 3--FILE-- 4<?php 5require __DIR__ . '/../../../vendor/autoload.php'; 6 7$generator = new PHPUnit_Framework_MockObject_Generator; 8 9$mock = $generator->generate( 10 'NonExistentClass', 11 array(), 12 'MockFoo', 13 true, 14 true 15); 16 17print $mock['code']; 18?> 19--EXPECTF-- 20class NonExistentClass 21{ 22} 23 24class MockFoo extends NonExistentClass implements PHPUnit_Framework_MockObject_MockObject 25{ 26 private $__phpunit_invocationMocker; 27 private $__phpunit_originalObject; 28 private $__phpunit_configurable = []; 29 30 public function __clone() 31 { 32 $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker(); 33 } 34 35 public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) 36 { 37 return $this->__phpunit_getInvocationMocker()->expects($matcher); 38 } 39 40 public function method() 41 { 42 $any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount; 43 $expects = $this->expects($any); 44 return call_user_func_array(array($expects, 'method'), func_get_args()); 45 } 46 47 public function __phpunit_setOriginalObject($originalObject) 48 { 49 $this->__phpunit_originalObject = $originalObject; 50 } 51 52 public function __phpunit_getInvocationMocker() 53 { 54 if ($this->__phpunit_invocationMocker === null) { 55 $this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable); 56 } 57 58 return $this->__phpunit_invocationMocker; 59 } 60 61 public function __phpunit_hasMatchers() 62 { 63 return $this->__phpunit_getInvocationMocker()->hasMatchers(); 64 } 65 66 public function __phpunit_verify($unsetInvocationMocker = true) 67 { 68 $this->__phpunit_getInvocationMocker()->verify(); 69 70 if ($unsetInvocationMocker) { 71 $this->__phpunit_invocationMocker = null; 72 } 73 } 74} 75