No Description

StaticTest.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestCase
  3. {
  4. public function testConstructorRequiresClassAndMethodAndParameters()
  5. {
  6. new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
  7. }
  8. public function testAllowToGetClassNameSetInConstructor()
  9. {
  10. $invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
  11. $this->assertSame('FooClass', $invocation->className);
  12. }
  13. public function testAllowToGetMethodNameSetInConstructor()
  14. {
  15. $invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
  16. $this->assertSame('FooMethod', $invocation->methodName);
  17. }
  18. public function testAllowToGetMethodParametersSetInConstructor()
  19. {
  20. $expectedParameters = array(
  21. 'foo', 5, array('a', 'b'), new StdClass, NULL, FALSE
  22. );
  23. $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
  24. 'FooClass', 'FooMethod', $expectedParameters
  25. );
  26. $this->assertSame($expectedParameters, $invocation->parameters);
  27. }
  28. public function testConstructorAllowToSetFlagCloneObjectsInParameters()
  29. {
  30. $parameters = array(new StdClass);
  31. $cloneObjects = TRUE;
  32. $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
  33. 'FooClass',
  34. 'FooMethod',
  35. $parameters,
  36. $cloneObjects
  37. );
  38. $this->assertEquals($parameters, $invocation->parameters);
  39. $this->assertNotSame($parameters, $invocation->parameters);
  40. }
  41. }