AudioscrobblerTestCase.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. require_once "Zend/Service/Audioscrobbler.php";
  23. require_once "Zend/Http/Client.php";
  24. require_once "Zend/Http/Client/Adapter/Test.php";
  25. /**
  26. * @category Zend
  27. * @package Zend_Service_Audioscrobbler
  28. * @subpackage UnitTests
  29. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. * @group Zend_Service
  32. * @group Zend_Service_Audioscrobbler
  33. */
  34. class Zend_Service_Audioscrobbler_AudioscrobblerTestCase extends PHPUnit_Framework_TestCase
  35. {
  36. /**
  37. * @var Zend_Http_Client
  38. */
  39. private $_httpClient = null;
  40. /**
  41. * @var Zend_Http_Client_Adapter_Test
  42. */
  43. private $_httpTestAdapter = null;
  44. /**
  45. * @var Zend_Service_Audioscrobbler
  46. */
  47. private $_asService = null;
  48. public function setUp()
  49. {
  50. $this->_httpTestAdapter = new Zend_Http_Client_Adapter_Test();
  51. $this->_httpClient = new Zend_Http_Client();
  52. $this->_httpClient->setConfig(array('adapter' => $this->_httpTestAdapter));
  53. $this->_asService = new Zend_Service_Audioscrobbler();
  54. $this->_asService->setHttpClient($this->_httpClient);
  55. }
  56. /**
  57. * @param string $responseMessage
  58. */
  59. protected function setAudioscrobblerResponse($responseMessage)
  60. {
  61. $this->_httpTestAdapter->setResponse($responseMessage);
  62. }
  63. /**
  64. * @return Zend_Service_Audioscrobbler
  65. */
  66. protected function getAudioscrobblerService()
  67. {
  68. return $this->_asService;
  69. }
  70. }