No Description

nonexistent_class_with_namespace.phpt 1.8KB

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