/tests/tests/lib/ezutils/server/README.rst

https://github.com/GunioRobot/ezpublish · ReStructuredText · 124 lines · 90 code · 34 blank · 0 comment · 0 complexity · 9701747cd273b064a86365f34fc6090e MD5 · raw file

  1. ===============================================
  2. General test data for httpd server unit testing
  3. ===============================================
  4. Intro
  5. -----
  6. This folder contains most important server variables available to php on different
  7. httpd servers and setup with different configuration.
  8. At time of writing: Apache, IIS, Nginx and Lighttpd on several OS's and with different conf.
  9. It is in a php array format for easy use in php applications for unit/regression testing,
  10. and its available in same license as eZ Publish (GPL v2), for other license options
  11. contact eZ Systems (ez.no).
  12. If you would like to contribute tests for some server, see end.
  13. Use cases
  14. ---------
  15. At the time of writing virtual host detection, routing and utf8 url encoding comes to mind.
  16. But should be able to be used for any unit/regression tests for PHP applications that want to
  17. test httpd server / OS differences.
  18. PHP Versions
  19. ------------
  20. Dataset only contains data for php versions above PHP 5.2.1 as this is the minimum requirements
  21. for eZ Publish. For IIS, only 5.3+ is available since that is the minimum version supported by MS.
  22. Variables
  23. ---------
  24. Variables available is the result of the following php code:
  25. (should work on all PHP 5.x versions, but have only been tested on 5.2+)
  26. ::
  27. if ( isset( $_GET['get'] ) && $_GET['get'] === 'value' )
  28. {
  29. header( 'Content-Type: text/php; charset=utf-8' );
  30. echo "<?php\n\nreturn " . var_export( array(
  31. 'PHP_VERSION' => PHP_VERSION,
  32. 'PHP_OS' => PHP_OS,
  33. 'PHP_SAPI' => PHP_SAPI,
  34. 'php_uname' => php_uname(),
  35. 'DIRECTORY_SEPARATOR' => DIRECTORY_SEPARATOR,
  36. 'PHP_SHLIB_SUFFIX' => PHP_SHLIB_SUFFIX,
  37. 'PATH_SEPARATOR' => PATH_SEPARATOR,
  38. 'DEFAULT_INCLUDE_PATH' => DEFAULT_INCLUDE_PATH,
  39. 'include_path' => ini_get( 'include_path' ),
  40. 'PHP_MAXPATHLEN' => defined('PHP_MAXPATHLEN') ? PHP_MAXPATHLEN : null,
  41. 'PHP_EOL' => PHP_EOL,
  42. 'PHP_INT_MAX' => PHP_INT_MAX,
  43. 'PHP_INT_SIZE' => PHP_INT_SIZE,
  44. 'getcwd' => getcwd(),
  45. '_SERVER' => $_SERVER,
  46. '_ENV' => isset( $_ENV ) ? $_ENV : null,
  47. ), true ) . ";\n";
  48. exit;
  49. }
  50. Structure
  51. ---------
  52. Dataset has the following folder structure:
  53. ::
  54. nvh
  55. \|-index
  56. \|-root
  57. \|-utf8
  58. \|-view
  59. vh
  60. \|-root
  61. \|-utf8
  62. \|-view
  63. vh: Virtual host mode (aka no 'index.php' as normally accomplished with rewrite rules)
  64. nvh: Non virtual host mode (aka has index.php in url)
  65. index: "/index.php" specific to nvh mode.
  66. root: "/" without index.php in url on both vh and nvh test
  67. utf8: "[/index.php]/News/Blåbær-Øl-med-d'or-新闻军事社会体育中超" where [/index.php] is only added in nvh mode
  68. view: "[/index.php]/content/view/full/44" Same as utf8, but with a simpler url
  69. Contribute
  70. ----------
  71. Contributions is done with Githubs fork -> change -> pull request workflow.
  72. More on that can be found on: <TODO: add ezp + git contribution link when live>
  73. Using code from 'Variables' in your index.php file (or if on a running eZ Publish install you can place it temporary in your config.php file), should allow you to generate data.
  74. The most important types of tests are root and utf8 and they are generated with the
  75. following paths:
  76. mode/type: vh/root
  77. http://<domain>/?get=value
  78. mode/type: vh/utf8
  79. http://<domain>/News/Blåbær-Øl-med-d'or-新闻军事社会体育中超?get=value
  80. mode/type: nvh/root
  81. http://localhost[/path]/?get=value
  82. mode/type: nvh/utf8
  83. http://localhost[/path]/index.php/News/Blåbær-Øl-med-d'or-新闻军事社会体育中超?get=value
  84. path: This is optional, some parts of the dataset contains sub paths, but not all!
  85. File name and path to store them in is:
  86. server/<mode>/<type>/<os>_<httpd><httpd_version>_<php_mode>_php<php_version>.php
  87. php_mode: The mode php is running in, either 'mod' (mod_php), 'fpm' or 'fastcgi'.
  88. Eg:
  89. server/nvh/utf8/win7_iis75_fastcgi_php533.php
  90. server/vh/root/linux_nginx0852_fpm_php533.php