PHPプラグイン:MakeGood

インストール

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック

「Next」をクリック



サンプルソース

コード

  1. <?php
  2. /**
  3.  * Generated by PHPUnit on 2009-10-22 at 13:07:33.
  4.  */
  5. class Employee
  6. {
  7. protected $age, $name;
  8.  
  9. /**
  10.   * @todo Implement getAge().
  11.   */
  12. public function getAge()
  13. {
  14. return $this->age;
  15. // Remove the following line when you implement this method.
  16. throw new RuntimeException('Not yet implemented.');
  17. }
  18.  
  19. /**
  20.   * @todo Implement getName().
  21.   */
  22. public function getName()
  23. {
  24. return $this->name;
  25. // Remove the following line when you implement this method.
  26. throw new RuntimeException('Not yet implemented.');
  27. }
  28.  
  29. /**
  30.   * @todo Implement setAge().
  31.   */
  32. public function setAge($age)
  33. {
  34. $this->age = $age;
  35. // Remove the following line when you implement this method.
  36. //throw new RuntimeException('Not yet implemented.');
  37. }
  38.  
  39. /**
  40.   * @todo Implement setName().
  41.   */
  42. public function setName($name)
  43. {
  44. $this->name = $name;
  45. // Remove the following line when you implement this method.
  46. //throw new RuntimeException('Not yet implemented.');
  47. }
  48. }?>
  49.  

テストコード

  1. <?php
  2.  
  3. require_once 'C:\Tools\Works\php\sample01\Employee.php';
  4.  
  5. /**
  6.  * Test class for Employee.
  7.  * Generated by PHPUnit on 2011-11-23 at 07:15:11.
  8.  */
  9. class EmployeeTest extends PHPUnit_Framework_TestCase
  10. {
  11. /**
  12.   * @var Employee
  13.   */
  14. protected $object;
  15.  
  16. /**
  17.   * Sets up the fixture, for example, opens a network connection.
  18.   * This method is called before a test is executed.
  19.   */
  20. protected function setUp()
  21. {
  22. $this->object = new Employee;
  23. }
  24.  
  25. /**
  26.   * Tears down the fixture, for example, closes a network connection.
  27.   * This method is called after a test is executed.
  28.   */
  29. protected function tearDown()
  30. {
  31. }
  32.  
  33. /**
  34.   * @covers {className}::{origMethodName}
  35.   * @todo Implement testGetAge().
  36.   */
  37. public function testGetAge()
  38. {
  39. $this->object->setAge(100);
  40. $this->assertEquals(100, $this->object->getAge());
  41. /*
  42.   // Remove the following lines when you implement this test.
  43.   $this->markTestIncomplete(
  44.   'This test has not been implemented yet.'
  45.   );
  46.   */
  47. }
  48.  
  49. /**
  50.   * @covers {className}::{origMethodName}
  51.   * @todo Implement testGetName().
  52.   */
  53. public function testGetName()
  54. {
  55. $this->object->setName("111");
  56. $this->assertEquals("111", $this->object->getName());
  57. /*
  58.   // Remove the following lines when you implement this test.
  59.   $this->markTestIncomplete(
  60.   'This test has not been implemented yet.'
  61.   );
  62.   */
  63. }
  64.  
  65. /**
  66.   * @covers {className}::{origMethodName}
  67.   * @todo Implement testSetAge().
  68.   */
  69. public function testSetAge()
  70. {
  71. $this->object->setAge(100);
  72. $this->assertEquals(100, $this->object->getAge());
  73.  
  74. /*
  75.   // Remove the following lines when you implement this test.
  76.   $this->markTestIncomplete(
  77.   'This test has not been implemented yet.'
  78.   );
  79.   */
  80. }
  81.  
  82. /**
  83.   * @covers {className}::{origMethodName}
  84.   * @todo Implement testSetName().
  85.   */
  86. public function testSetName()
  87. {
  88. $this->object->setName("111");
  89. $this->assertEquals("111", $this->object->getName());
  90.  
  91. /*
  92.   // Remove the following lines when you implement this test.
  93.   $this->markTestIncomplete(
  94.   'This test has not been implemented yet.'
  95.   );*/
  96. }
  97. }
  98. ?>
  99.  
  100.  


結果確認



最終更新:2011年11月23日 23:16