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