ObjectTest.php (2329B)
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 public function testAllowToGetClassNameSetInConstructor() 15 { 16 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( 17 'FooClass', 18 'FooMethod', 19 array('an_argument'), 20 new StdClass); 21 22 $this->assertSame('FooClass', $invocation->className); 23 } 24 25 public function testAllowToGetMethodNameSetInConstructor() 26 { 27 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( 28 'FooClass', 29 'FooMethod', 30 array('an_argument'), 31 new StdClass); 32 33 $this->assertSame('FooMethod', $invocation->methodName); 34 } 35 36 public function testAllowToGetObjectSetInConstructor() 37 { 38 $expectedObject = new StdClass; 39 40 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( 41 'FooClass', 42 'FooMethod', 43 array('an_argument'), 44 $expectedObject); 45 46 $this->assertSame($expectedObject, $invocation->object); 47 } 48 49 public function testAllowToGetMethodParametersSetInConstructor() 50 { 51 $expectedParameters = array( 52 'foo', 5, array('a', 'b'), new StdClass, NULL, FALSE 53 ); 54 55 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( 56 'FooClass', 57 'FooMethod', 58 $expectedParameters, 59 new StdClass 60 ); 61 62 $this->assertSame($expectedParameters, $invocation->parameters); 63 } 64 65 public function testConstructorAllowToSetFlagCloneObjectsInParameters() 66 { 67 $parameters = array(new StdClass); 68 $cloneObjects = TRUE; 69 70 $invocation = new PHPUnit_Framework_MockObject_Invocation_Object( 71 'FooClass', 72 'FooMethod', 73 $parameters, 74 new StdClass, 75 $cloneObjects 76 ); 77 78 $this->assertEquals($parameters, $invocation->parameters); 79 $this->assertNotSame($parameters, $invocation->parameters); 80 } 81 } 82