pin_guide_ms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.5 KiB

3 years ago
  1. <?php
  2. /**
  3. * TestBase.php
  4. * Test Base controller.
  5. * @version 150629:1
  6. * @author karminski <code.karminski@outlook.com>
  7. *
  8. */
  9. /**
  10. * abstract class TestBase
  11. */
  12. abstract class TestBase{
  13. public $_log;
  14. /**
  15. * [__construct description]
  16. */
  17. public function __construct($requirements){
  18. // require
  19. $this->InitRequirements($requirements);
  20. // check mode
  21. if(ONLINE_MODE){
  22. $debug = false;
  23. }else{
  24. $debug = true;
  25. }
  26. // load files
  27. $this->initLog($debug);
  28. $this->debugSwitch(true);
  29. }
  30. /**
  31. * [debugSwitch description]
  32. * @param boolean $switch [description]
  33. * @return [type] [description]
  34. */
  35. public function debugSwitch($switch = false){
  36. if($switch){
  37. ini_set('display_errors', 1);
  38. error_reporting(E_ALL);
  39. }
  40. return;
  41. }
  42. /**
  43. * [InitRequirements description]
  44. */
  45. public function InitRequirements($requirements){
  46. $class_name = get_class($this);
  47. require(dirname(__FILE__).'/../protected/lib/base/AutoRequire.php');
  48. AutoRequire::_class($requirements);
  49. return;
  50. }
  51. /**
  52. * [initLog description]
  53. * @param [type] $debug [description]
  54. * @return [type] [description]
  55. */
  56. public function initLog($debug){
  57. $this->_log = new Log();
  58. $this->_log->setLogAddress(LOG_FILE, LOG_SPLIT);
  59. $this->_log->setEchoSwitch($debug);
  60. return;
  61. }
  62. }