Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestCase
|
Chris@0
|
4 {
|
Chris@0
|
5 public function testConstructorRequiresClassAndMethodAndParameters()
|
Chris@0
|
6 {
|
Chris@0
|
7 new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
|
Chris@0
|
8 }
|
Chris@0
|
9
|
Chris@0
|
10 public function testAllowToGetClassNameSetInConstructor()
|
Chris@0
|
11 {
|
Chris@0
|
12 $invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
|
Chris@0
|
13
|
Chris@0
|
14 $this->assertSame('FooClass', $invocation->className);
|
Chris@0
|
15 }
|
Chris@0
|
16
|
Chris@0
|
17 public function testAllowToGetMethodNameSetInConstructor()
|
Chris@0
|
18 {
|
Chris@0
|
19 $invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
|
Chris@0
|
20
|
Chris@0
|
21 $this->assertSame('FooMethod', $invocation->methodName);
|
Chris@0
|
22 }
|
Chris@0
|
23
|
Chris@0
|
24 public function testAllowToGetMethodParametersSetInConstructor()
|
Chris@0
|
25 {
|
Chris@0
|
26 $expectedParameters = array(
|
Chris@0
|
27 'foo', 5, array('a', 'b'), new StdClass, null, false
|
Chris@0
|
28 );
|
Chris@0
|
29
|
Chris@0
|
30 $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
|
Chris@0
|
31 'FooClass',
|
Chris@0
|
32 'FooMethod',
|
Chris@0
|
33 $expectedParameters
|
Chris@0
|
34 );
|
Chris@0
|
35
|
Chris@0
|
36 $this->assertSame($expectedParameters, $invocation->parameters);
|
Chris@0
|
37 }
|
Chris@0
|
38
|
Chris@0
|
39 public function testConstructorAllowToSetFlagCloneObjectsInParameters()
|
Chris@0
|
40 {
|
Chris@0
|
41 $parameters = array(new StdClass);
|
Chris@0
|
42 $cloneObjects = true;
|
Chris@0
|
43
|
Chris@0
|
44 $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
|
Chris@0
|
45 'FooClass',
|
Chris@0
|
46 'FooMethod',
|
Chris@0
|
47 $parameters,
|
Chris@0
|
48 $cloneObjects
|
Chris@0
|
49 );
|
Chris@0
|
50
|
Chris@0
|
51 $this->assertEquals($parameters, $invocation->parameters);
|
Chris@0
|
52 $this->assertNotSame($parameters, $invocation->parameters);
|
Chris@0
|
53 }
|
Chris@0
|
54 }
|