PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/addons/tests/test.php

https://github.com/xrg/a2billing
PHP | 83 lines | 65 code | 12 blank | 6 comment | 8 complexity | 54ff75125b424e7c8fc0b84b43a6d980 MD5 | raw file
Possible License(s): AGPL-1.0
  1. #!/usr/bin/php
  2. <?php
  3. define("DEFAULT_A2BILLING_CONFIG", '../../a2billing.conf.testing');
  4. // echo DEFAULT_A2BILLING_CONFIG;
  5. // echo "\n";
  6. $FG_DEBUG=2;
  7. if (false){
  8. print_r(A2Billing::DBHandle());
  9. }
  10. if (false) {
  11. require_once('Class.Logger.php');
  12. $loog = new Logger();
  13. $loog-> insertLog(0, 1, "TEST", "test entry!", 'aa','bb','cc');
  14. }
  15. if (false) {
  16. require_once('Class.DynConf.php');
  17. $inst = DynConf::instance();
  18. $inst->PrefetchGroup('general');
  19. $inst->dbg_print_cached_config();
  20. DynConf::instance()->dbg_print_cached_config();
  21. $val = DynConf::GetCfg('general','test',123);
  22. print_r($val);
  23. echo "\n";
  24. print_r(DynConf::GetCfg('general','test2'));
  25. echo "\n";
  26. print_r(DynConf::GetCfg('general','test'));
  27. echo "\n";
  28. }
  29. function isnumeric($v){
  30. //return (preg_match('/^\-?[0-9]+$/',$v)>=1);
  31. return (preg_match('/^\-?[0-9]+([,.][0-9]*)?$/',$v)>=1);
  32. }
  33. if (false) {
  34. $examples=array('1','500','','ab123','20 1234','-100','12-3','--600','9823748716249876194652',
  35. '1.0','500,2','','ab,123','20, 1234','-100.0','12.3','-600.','98.23748716249876194652');
  36. foreach ($examples as $ex){
  37. echo "Example \"$ex\" -> ";
  38. print_r(isnumeric($ex));
  39. echo "\n";
  40. }
  41. }
  42. if (false){
  43. require_once('Class.A2Billing.inc.php');
  44. $dbh=A2Billing::DBHandle();
  45. // Execute a query with some results and some warnings..
  46. $res = $dbh->Execute('SELECT * from RateEngine2(1,\'+7831222\',now(),-1);');
  47. echo "Msg:" . print_r($dbh->ErrorMsg(),true) . "\n";
  48. echo "Msg 2:" . print_r($dbh->NoticeMsg(),true) . "\n";
  49. print_r($res->GetAll());
  50. //print_r($dbh);
  51. }
  52. if (false) {
  53. require_once('Class.A2Billing.inc.php');
  54. $dbh=A2Billing::DBHandle();
  55. print_r($dbh);
  56. }
  57. if (false){
  58. require_once('Class.A2Billing.inc.php');
  59. $dbh=A2Billing::DBHandle();
  60. echo "Connected!\n";
  61. $dbh->Execute("LISTEN test;");
  62. pg_wait_notify($dbh->_connectionID, 30000);
  63. echo "Done!\n";
  64. }
  65. if(true){
  66. require("../A2Billing_AGI/groupdial.inc.php");
  67. echo "Result:";
  68. print_r(groupstr_analyze($argv[1]));
  69. echo "\n";
  70. }
  71. ?>