add myCalendar into
[awl.git] / vendor / phpunit / phpunit-mock-objects / Tests / MockObject / class_partial.phpt
blob0720b13fbb311122de67c5eebc956d24e5727e26
1 --TEST--
2 PHPUnit_Framework_MockObject_Generator::generate('Foo', array('bar'), 'MockFoo', TRUE, TRUE)
3 --FILE--
4 <?php
5 class Foo
7     public function bar(Foo $foo)
8     {
9     }
11     public function baz(Foo $foo)
12     {
13     }
16 require_once 'PHPUnit/Autoload.php';
17 require_once 'Text/Template.php';
19 $mock = PHPUnit_Framework_MockObject_Generator::generate(
20   'Foo',
21   array('bar'),
22   'MockFoo',
23   TRUE,
24   TRUE
27 print $mock['code'];
29 --EXPECTF--
30 class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
32     private static $__phpunit_staticInvocationMocker;
33     private $__phpunit_invocationMocker;
35     public function __clone()
36     {
37         $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
38     }
40     public function bar(Foo $foo)
41     {
42         $arguments = array($foo);
43         $count     = func_num_args();
45         if ($count > 1) {
46             $_arguments = func_get_args();
48             for ($i = 1; $i < $count; $i++) {
49                 $arguments[] = $_arguments[$i];
50             }
51         }
53         $result = $this->__phpunit_getInvocationMocker()->invoke(
54           new PHPUnit_Framework_MockObject_Invocation_Object(
55             'Foo', 'bar', $arguments, $this, TRUE
56           )
57         );
59         return $result;
60     }
62     public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
63     {
64         return $this->__phpunit_getInvocationMocker()->expects($matcher);
65     }
67     public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
68     {
69         return self::__phpunit_getStaticInvocationMocker()->expects($matcher);
70     }
72     public function __phpunit_getInvocationMocker()
73     {
74         if ($this->__phpunit_invocationMocker === NULL) {
75             $this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
76         }
78         return $this->__phpunit_invocationMocker;
79     }
81     public static function __phpunit_getStaticInvocationMocker()
82     {
83         if (self::$__phpunit_staticInvocationMocker === NULL) {
84             self::$__phpunit_staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
85         }
87         return self::$__phpunit_staticInvocationMocker;
88     }
90     public function __phpunit_hasMatchers()
91     {
92         return self::__phpunit_getStaticInvocationMocker()->hasMatchers() ||
93                $this->__phpunit_getInvocationMocker()->hasMatchers();
94     }
96     public function __phpunit_verify()
97     {
98         self::__phpunit_getStaticInvocationMocker()->verify();
99         $this->__phpunit_getInvocationMocker()->verify();
100     }
102     public function __phpunit_cleanup()
103     {
104         self::$__phpunit_staticInvocationMocker = NULL;
105         $this->__phpunit_invocationMocker       = NULL;
106     }