StaticTest.php (1694B)
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', 'FooMethod', $expectedParameters 32 ); 33 34 $this->assertSame($expectedParameters, $invocation->parameters); 35 } 36 37 public function testConstructorAllowToSetFlagCloneObjectsInParameters() 38 { 39 $parameters = array(new StdClass); 40 $cloneObjects = TRUE; 41 42 $invocation = new PHPUnit_Framework_MockObject_Invocation_Static( 43 'FooClass', 44 'FooMethod', 45 $parameters, 46 $cloneObjects 47 ); 48 49 $this->assertEquals($parameters, $invocation->parameters); 50 $this->assertNotSame($parameters, $invocation->parameters); 51 } 52 }