MyObjectTest.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /* <one line to give the program's name and a brief idea of what it does.>
  3. * Copyright (C) <year> <name of author>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file test/unit/MyObjectTest.php
  20. * \ingroup mymodule
  21. * \brief PHPUnit test for MyObject class.
  22. */
  23. namespace test\unit;
  24. /**
  25. * Class MyObjectTest
  26. * @package Testmymodule
  27. */
  28. class MyObjectTest extends \PHPUnit_Framework_TestCase
  29. {
  30. /**
  31. * Global test setup
  32. */
  33. public static function setUpBeforeClass()
  34. {
  35. fwrite(STDOUT, __METHOD__ . "\n");
  36. }
  37. /**
  38. * Unit test setup
  39. */
  40. protected function setUp()
  41. {
  42. fwrite(STDOUT, __METHOD__ . "\n");
  43. }
  44. /**
  45. * Verify pre conditions
  46. */
  47. protected function assertPreConditions()
  48. {
  49. fwrite(STDOUT, __METHOD__ . "\n");
  50. }
  51. /**
  52. * A sample test
  53. */
  54. public function testSomething()
  55. {
  56. fwrite(STDOUT, __METHOD__ . "\n");
  57. // TODO: test something
  58. $this->assertTrue(true);
  59. }
  60. /**
  61. * Verify post conditions
  62. */
  63. protected function assertPostConditions()
  64. {
  65. fwrite(STDOUT, __METHOD__ . "\n");
  66. }
  67. /**
  68. * Unit test teardown
  69. */
  70. protected function tearDown()
  71. {
  72. fwrite(STDOUT, __METHOD__ . "\n");
  73. }
  74. /**
  75. * Global test teardown
  76. */
  77. public static function tearDownAfterClass()
  78. {
  79. fwrite(STDOUT, __METHOD__ . "\n");
  80. }
  81. /**
  82. * Unsuccessful test
  83. *
  84. * @param Exception $e Exception
  85. * @throws Exception
  86. */
  87. protected function onNotSuccessfulTest(Exception $e)
  88. {
  89. fwrite(STDOUT, __METHOD__ . "\n");
  90. throw $e;
  91. }
  92. }