Soundcloud_Test_Helper.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. set_include_path(
  3. get_include_path()
  4. . PATH_SEPARATOR
  5. . realpath(dirname(__FILE__) . '/../')
  6. );
  7. require_once 'Services/Soundcloud.php';
  8. /**
  9. * Extended class of the Soundcloud class in order to expose protected methods
  10. * for testing.
  11. *
  12. * @category Services
  13. * @package Services_Soundcloud
  14. * @author Anton Lindqvist <anton@qvister.se>
  15. * @copyright 2010 Anton Lindqvist <anton@qvister.se>
  16. * @license http://www.opensource.org/licenses/mit-license.php MIT
  17. * @link http://github.com/mptre/php-soundcloud
  18. */
  19. class Services_Soundcloud_Expose extends Services_Soundcloud {
  20. /**
  21. * Class constructor. See parent constructor for further reference.
  22. *
  23. * @param string $clientId Application client id
  24. * @param string $clientSecret Application client secret
  25. * @param string $redirectUri Application redirect uri
  26. * @param boolean $development Sandbox mode
  27. *
  28. * @return void
  29. * @see Soundcloud
  30. */
  31. function __construct($clientId, $clientSecret, $redirectUri = null, $development = false) {
  32. parent::__construct($clientId, $clientSecret, $redirectUri, $development);
  33. }
  34. /**
  35. * Construct default http headers including response format and authorization.
  36. *
  37. * @return array
  38. * @see Soundcloud::_buildDefaultHeaders()
  39. */
  40. function buildDefaultHeaders() {
  41. return $this->_buildDefaultHeaders();
  42. }
  43. /**
  44. * Construct a url.
  45. *
  46. * @param string $path Relative or absolute uri
  47. * @param array $params Optional query string parameters
  48. * @param boolean $includeVersion Include the api version
  49. *
  50. * @return string
  51. * @see Soundcloud::_buildUrl()
  52. */
  53. function buildUrl($path, $params = null, $includeVersion = true) {
  54. return $this->_buildUrl($path, $params, $includeVersion);
  55. }
  56. /**
  57. * Get http user agent.
  58. *
  59. * @return string
  60. * @see Soundcloud::_getUserAgent()
  61. */
  62. function getUserAgent() {
  63. return $this->_getUserAgent();
  64. }
  65. /**
  66. * Parse HTTP response headers.
  67. *
  68. * @param string $headers
  69. *
  70. * @return array
  71. * @see Soundcloud::_parseHttpHeaders()
  72. */
  73. function parseHttpHeaders($headers) {
  74. return $this->_parseHttpHeaders($headers);
  75. }
  76. /**
  77. * Validates http response code.
  78. *
  79. * @return boolean
  80. * @see Soundcloud::_validResponseCode()
  81. */
  82. function validResponseCode($code) {
  83. return $this->_validResponseCode($code);
  84. }
  85. }