Drupal investigation

StaticTest.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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',
  25. 'FooMethod',
  26. $expectedParameters
  27. );
  28. $this->assertSame($expectedParameters, $invocation->parameters);
  29. }
  30. public function testConstructorAllowToSetFlagCloneObjectsInParameters()
  31. {
  32. $parameters = array(new StdClass);
  33. $cloneObjects = true;
  34. $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
  35. 'FooClass',
  36. 'FooMethod',
  37. $parameters,
  38. $cloneObjects
  39. );
  40. $this->assertEquals($parameters, $invocation->parameters);
  41. $this->assertNotSame($parameters, $invocation->parameters);
  42. }
  43. }