PubsubhubbubTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 UnitTests
  17. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
  22. require_once 'Zend/Feed/Pubsubhubbub.php';
  23. /**
  24. * @category Zend
  25. * @package Zend_Feed
  26. * @subpackage UnitTests
  27. * @group Zend_Feed
  28. * @group Zend_Feed_Subsubhubbub
  29. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_Feed_Pubsubhubbub_PubsubhubbubTest extends PHPUnit_Framework_TestCase
  33. {
  34. public function teardown()
  35. {
  36. Zend_Feed_Pubsubhubbub::clearHttpClient();
  37. }
  38. public function testCanSetCustomHttpClient()
  39. {
  40. Zend_Feed_Pubsubhubbub::setHttpClient(new Test_Http_Client_Pubsub());
  41. $this->assertType('Test_Http_Client_Pubsub', Zend_Feed_Pubsubhubbub::getHttpClient());
  42. }
  43. public function testCanDetectHubs()
  44. {
  45. $feed = Zend_Feed_Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml');
  46. $this->assertEquals(array(
  47. 'http://www.example.com/hub', 'http://www.example.com/hub2'
  48. ), Zend_Feed_Pubsubhubbub::detectHubs($feed));
  49. }
  50. }
  51. class Test_Http_Client_Pubsub extends Zend_Http_Client {}