Mercurial > hg > isophonics-drupal-site
comparison vendor/phpunit/phpunit-mock-objects/tests/MockObject/Invocation/ObjectTest.php @ 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 <?php | |
2 | |
3 class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestCase | |
4 { | |
5 public function testConstructorRequiresClassAndMethodAndParametersAndObject() | |
6 { | |
7 new PHPUnit_Framework_MockObject_Invocation_Object( | |
8 'FooClass', | |
9 'FooMethod', | |
10 array('an_argument'), | |
11 new StdClass | |
12 ); | |
13 } | |
14 | |
15 public function testAllowToGetClassNameSetInConstructor() | |
16 { | |
17 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( | |
18 'FooClass', | |
19 'FooMethod', | |
20 array('an_argument'), | |
21 new StdClass | |
22 ); | |
23 | |
24 $this->assertSame('FooClass', $invocation->className); | |
25 } | |
26 | |
27 public function testAllowToGetMethodNameSetInConstructor() | |
28 { | |
29 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( | |
30 'FooClass', | |
31 'FooMethod', | |
32 array('an_argument'), | |
33 new StdClass | |
34 ); | |
35 | |
36 $this->assertSame('FooMethod', $invocation->methodName); | |
37 } | |
38 | |
39 public function testAllowToGetObjectSetInConstructor() | |
40 { | |
41 $expectedObject = new StdClass; | |
42 | |
43 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( | |
44 'FooClass', | |
45 'FooMethod', | |
46 array('an_argument'), | |
47 $expectedObject | |
48 ); | |
49 | |
50 $this->assertSame($expectedObject, $invocation->object); | |
51 } | |
52 | |
53 public function testAllowToGetMethodParametersSetInConstructor() | |
54 { | |
55 $expectedParameters = array( | |
56 'foo', 5, array('a', 'b'), new StdClass, null, false | |
57 ); | |
58 | |
59 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( | |
60 'FooClass', | |
61 'FooMethod', | |
62 $expectedParameters, | |
63 new StdClass | |
64 ); | |
65 | |
66 $this->assertSame($expectedParameters, $invocation->parameters); | |
67 } | |
68 | |
69 public function testConstructorAllowToSetFlagCloneObjectsInParameters() | |
70 { | |
71 $parameters = array(new StdClass); | |
72 $cloneObjects = true; | |
73 | |
74 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( | |
75 'FooClass', | |
76 'FooMethod', | |
77 $parameters, | |
78 new StdClass, | |
79 $cloneObjects | |
80 ); | |
81 | |
82 $this->assertEquals($parameters, $invocation->parameters); | |
83 $this->assertNotSame($parameters, $invocation->parameters); | |
84 } | |
85 } |