AudioscrobblerTestCase.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service_Audioscrobbler
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. require_once "Zend/Service/Audioscrobbler.php";
  22. require_once "Zend/Http/Client.php";
  23. require_once "Zend/Http/Client/Adapter/Test.php";
  24. class Zend_Service_Audioscrobbler_AudioscrobblerTestCase extends PHPUnit_Framework_TestCase
  25. {
  26. /**
  27. * @var Zend_Http_Client
  28. */
  29. private $_httpClient = null;
  30. /**
  31. * @var Zend_Http_Client_Adapter_Test
  32. */
  33. private $_httpTestAdapter = null;
  34. /**
  35. * @var Zend_Service_Audioscrobbler
  36. */
  37. private $_asService = null;
  38. public function setUp()
  39. {
  40. $this->_httpTestAdapter = new Zend_Http_Client_Adapter_Test();
  41. $this->_httpClient = new Zend_Http_Client();
  42. $this->_httpClient->setConfig(array('adapter' => $this->_httpTestAdapter));
  43. $this->_asService = new Zend_Service_Audioscrobbler();
  44. $this->_asService->setHttpClient($this->_httpClient);
  45. }
  46. /**
  47. * @param string $responseMessage
  48. */
  49. protected function setAudioscrobblerResponse($responseMessage)
  50. {
  51. $this->_httpTestAdapter->setResponse($responseMessage);
  52. }
  53. /**
  54. * @return Zend_Service_Audioscrobbler
  55. */
  56. protected function getAudioscrobblerService()
  57. {
  58. return $this->_asService;
  59. }
  60. }