Mercurial > hg > isophonics-drupal-site
comparison vendor/phpunit/phpunit-mock-objects/tests/MockObject/nonexistent_class.phpt @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 --TEST-- | |
2 PHPUnit_Framework_MockObject_Generator::generate('NonExistentClass', array(), 'MockFoo', TRUE, TRUE) | |
3 --FILE-- | |
4 <?php | |
5 require __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 | |
17 print $mock['code']; | |
18 ?> | |
19 --EXPECTF-- | |
20 class NonExistentClass | |
21 { | |
22 } | |
23 | |
24 class MockFoo extends NonExistentClass implements PHPUnit_Framework_MockObject_MockObject | |
25 { | |
26 private $__phpunit_invocationMocker; | |
27 private $__phpunit_originalObject; | |
28 | |
29 public function __clone() | |
30 { | |
31 $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker(); | |
32 } | |
33 | |
34 public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | |
35 { | |
36 return $this->__phpunit_getInvocationMocker()->expects($matcher); | |
37 } | |
38 | |
39 public function method() | |
40 { | |
41 $any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount; | |
42 $expects = $this->expects($any); | |
43 return call_user_func_array(array($expects, 'method'), func_get_args()); | |
44 } | |
45 | |
46 public function __phpunit_setOriginalObject($originalObject) | |
47 { | |
48 $this->__phpunit_originalObject = $originalObject; | |
49 } | |
50 | |
51 public function __phpunit_getInvocationMocker() | |
52 { | |
53 if ($this->__phpunit_invocationMocker === NULL) { | |
54 $this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; | |
55 } | |
56 | |
57 return $this->__phpunit_invocationMocker; | |
58 } | |
59 | |
60 public function __phpunit_hasMatchers() | |
61 { | |
62 return $this->__phpunit_getInvocationMocker()->hasMatchers(); | |
63 } | |
64 | |
65 public function __phpunit_verify() | |
66 { | |
67 $this->__phpunit_getInvocationMocker()->verify(); | |
68 $this->__phpunit_invocationMocker = NULL; | |
69 } | |
70 } |