PageRenderTime 30ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/MantisBT/tests/test_config_get_set.php

https://bitbucket.org/crypticrod/sr_wp_code
PHP | 63 lines | 29 code | 5 blank | 29 comment | 0 complexity | 27a28c0179859a17a3e184a8aae06fd8 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.1, GPL-3.0, LGPL-2.0, AGPL-3.0
  1. <?php
  2. # MantisBT - a php based bugtracking system
  3. # MantisBT is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # MantisBT is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
  15. /**
  16. * @package MantisBT
  17. * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
  18. * @link http://www.mantisbt.org
  19. */
  20. /**
  21. * MantisBT Unit Test
  22. */
  23. /**
  24. * test config_get and config_set
  25. *
  26. * run from command line using: php -q test_config_get_set.php
  27. * inspect results manually
  28. * Notes:
  29. * data set from the test may need to be removed from the database manually
  30. */
  31. require_once( 'test.php' );
  32. $t_config = 'main_menu_custom_options';
  33. $t_test = config_get( $t_config );
  34. print_r( $t_config);
  35. print_r( $t_test );
  36. $t_test[0][1] = 20;
  37. config_set( $t_config, $t_test );
  38. $t_test = config_get( $t_config );
  39. print_r( $t_test );
  40. $t_config = 'default_home_page';
  41. $t_test = config_get( $t_config );
  42. print_r( $t_config);
  43. print_r( $t_test );
  44. $t_test .= '?test';
  45. config_set( $t_config, $t_test );
  46. $t_test = config_get( $t_config );
  47. print_r( $t_test );
  48. $g_test_config = array();
  49. $t_config = 'test_config';
  50. $t_test = config_get( $t_config );
  51. print_r( $t_config);
  52. print_r( $t_test );
  53. echo " ".(isset($t_test[0])?"set":"not set")." ".count($t_test)." ";
  54. $t_test[0] = 20;
  55. config_set( $t_config, $t_test );
  56. $t_test = config_get( $t_config );
  57. print_r( $t_test );
  58. echo " ".(isset($t_test[0])?"set":"not set")." ".count($t_test)." ";