locale_accept.phpt 765 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. locale_accept_from_http
  3. --EXTENSIONS--
  4. intl
  5. --FILE--
  6. <?php
  7. /*
  8. * Try parsing different Locales
  9. * with Procedural and Object methods.
  10. */
  11. function ut_main()
  12. {
  13. $res_str = "";
  14. $http_acc = array(
  15. 'en-us,en;q=0.5',
  16. 'da, en-gb;q=0.8, en;q=0.7',
  17. 'zh, en-us;q=0.8, en;q=0.7',
  18. 'xx, fr-FR;q=0.3, de-DE;q=0.5',
  19. 'none',
  20. );
  21. foreach($http_acc as $http) {
  22. $res = ut_loc_accept_http($http);
  23. $res_str .= @"Accepting $http: $res\n";
  24. }
  25. return $res_str;
  26. }
  27. include_once( 'ut_common.inc' );
  28. ut_run();
  29. ?>
  30. --EXPECT--
  31. Accepting en-us,en;q=0.5: en_US
  32. Accepting da, en-gb;q=0.8, en;q=0.7: da
  33. Accepting zh, en-us;q=0.8, en;q=0.7: zh
  34. Accepting xx, fr-FR;q=0.3, de-DE;q=0.5: de_DE
  35. Accepting none: