Permalink
Browse files

Merge branch 'release'

  • Loading branch information...
2 parents 046800d + dda977b commit e1db90ccdab2dcba93ef36ca2e1303ff57893aaa @weierophinney weierophinney committed Sep 13, 2012
Showing with 1,720 additions and 1,363 deletions.
  1. +5 −5 library/Zend/Feed/Writer/Feed.php
  2. +0 −3 library/Zend/Feed/Writer/Renderer/Feed/Rss.php
  3. +62 −62 tests/ZendTest/Feed/PubSubHubbub/PublisherTest.php
  4. +27 −27 tests/ZendTest/Feed/PubSubHubbub/SubscriberHttpTest.php
  5. +61 −61 tests/ZendTest/Feed/PubSubHubbub/SubscriberTest.php
  6. +23 −23 tests/ZendTest/Feed/Reader/Entry/AtomStandaloneEntryTest.php
  7. +46 −46 tests/ZendTest/Feed/Reader/Entry/AtomTest.php
  8. +14 −14 tests/ZendTest/Feed/Reader/Entry/CommonTest.php
  9. +306 −306 tests/ZendTest/Feed/Reader/Entry/RssTest.php
  10. +23 −23 tests/ZendTest/Feed/Reader/Feed/AtomSourceTest.php
  11. +54 −54 tests/ZendTest/Feed/Reader/Feed/AtomTest.php
  12. +12 −12 tests/ZendTest/Feed/Reader/Feed/CommonTest.php
  13. +309 −309 tests/ZendTest/Feed/Reader/Feed/RssTest.php
  14. +21 −21 tests/ZendTest/Feed/Reader/Integration/H-OnlineComAtom10Test.php
  15. +20 −20 tests/ZendTest/Feed/Reader/Integration/LautDeRdfTest.php
  16. +27 −27 tests/ZendTest/Feed/Reader/Integration/PodcastRss2Test.php
  17. +21 −21 tests/ZendTest/Feed/Reader/Integration/WordpressAtom10Test.php
  18. +21 −21 tests/ZendTest/Feed/Reader/Integration/WordpressRss2DcAtomTest.php
  19. +14 −14 tests/ZendTest/Feed/Reader/ReaderTest.php
  20. +77 −0 tests/ZendTest/Feed/Writer/DeletedTest.php
  21. +114 −6 tests/ZendTest/Feed/Writer/EntryTest.php
  22. +166 −2 tests/ZendTest/Feed/Writer/FeedTest.php
  23. +63 −63 tests/ZendTest/Feed/Writer/Renderer/Entry/AtomTest.php
  24. +68 −68 tests/ZendTest/Feed/Writer/Renderer/Entry/RssTest.php
  25. +69 −69 tests/ZendTest/Feed/Writer/Renderer/Feed/AtomTest.php
  26. +97 −86 tests/ZendTest/Feed/Writer/Renderer/Feed/RssTest.php
@@ -37,7 +37,7 @@ class Feed extends AbstractFeed implements Iterator, Countable
protected $entriesKey = 0;
/**
- * Creates a new Zend_Feed_Writer_Entry data container for use. This is NOT
+ * Creates a new Zend\Feed\Writer\Entry data container for use. This is NOT
* added to the current feed automatically, but is necessary to create a
* container with some initial values preset based on the current feed data.
*
@@ -66,7 +66,7 @@ public function addTombstone(Deleted $deleted)
}
/**
- * Creates a new Zend_Feed_Writer_Deleted data container for use. This is NOT
+ * Creates a new Zend\Feed\Writer\Deleted data container for use. This is NOT
* added to the current feed automatically, but is necessary to create a
* container with some initial values preset based on the current feed data.
*
@@ -102,10 +102,10 @@ public function addEntry(Entry $entry)
*/
public function removeEntry($index)
{
- if (isset($this->entries[$index])) {
- unset($this->entries[$index]);
+ if (!isset($this->entries[$index])) {
+ throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.');
}
- throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.');
+ unset($this->entries[$index]);
}
/**
@@ -41,9 +41,6 @@ public function __construct (Writer\Feed $container)
*/
public function render()
{
- if (!$this->container->getEncoding()) {
- $this->container->setEncoding('UTF-8');
- }
$this->dom = new DOMDocument('1.0', $this->container->getEncoding());
$this->dom->formatOutput = true;
$this->dom->substituteEntities = false;
@@ -25,13 +25,13 @@
class PublisherTest extends \PHPUnit_Framework_TestCase
{
/** @var Publisher */
- protected $_publisher = null;
+ protected $publisher = null;
public function setUp()
{
$client = new HttpClient;
PubSubHubbub::setHttpClient($client);
- $this->_publisher = new Publisher;
+ $this->publisher = new Publisher;
}
public function getClientSuccess()
@@ -58,206 +58,206 @@ public function getClientFail()
public function testAddsHubServerUrl()
{
- $this->_publisher->addHubUrl('http://www.example.com/hub');
- $this->assertEquals(array('http://www.example.com/hub'), $this->_publisher->getHubUrls());
+ $this->publisher->addHubUrl('http://www.example.com/hub');
+ $this->assertEquals(array('http://www.example.com/hub'), $this->publisher->getHubUrls());
}
public function testAddsHubServerUrlsFromArray()
{
- $this->_publisher->addHubUrls(array(
+ $this->publisher->addHubUrls(array(
'http://www.example.com/hub', 'http://www.example.com/hub2'
));
$this->assertEquals(array(
'http://www.example.com/hub', 'http://www.example.com/hub2'
- ), $this->_publisher->getHubUrls());
+ ), $this->publisher->getHubUrls());
}
public function testAddsHubServerUrlsFromArrayUsingSetConfig()
{
- $this->_publisher->setOptions(array('hubUrls' => array(
+ $this->publisher->setOptions(array('hubUrls' => array(
'http://www.example.com/hub', 'http://www.example.com/hub2'
)));
$this->assertEquals(array(
'http://www.example.com/hub', 'http://www.example.com/hub2'
- ), $this->_publisher->getHubUrls());
+ ), $this->publisher->getHubUrls());
}
public function testRemovesHubServerUrl()
{
- $this->_publisher->addHubUrls(array(
+ $this->publisher->addHubUrls(array(
'http://www.example.com/hub', 'http://www.example.com/hub2'
));
- $this->_publisher->removeHubUrl('http://www.example.com/hub');
+ $this->publisher->removeHubUrl('http://www.example.com/hub');
$this->assertEquals(array(
1 => 'http://www.example.com/hub2'
- ), $this->_publisher->getHubUrls());
+ ), $this->publisher->getHubUrls());
}
public function testRetrievesUniqueHubServerUrlsOnly()
{
- $this->_publisher->addHubUrls(array(
+ $this->publisher->addHubUrls(array(
'http://www.example.com/hub', 'http://www.example.com/hub2',
'http://www.example.com/hub'
));
$this->assertEquals(array(
'http://www.example.com/hub', 'http://www.example.com/hub2'
- ), $this->_publisher->getHubUrls());
+ ), $this->publisher->getHubUrls());
}
public function testThrowsExceptionOnSettingEmptyHubServerUrl()
{
$this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
- $this->_publisher->addHubUrl('');
+ $this->publisher->addHubUrl('');
}
public function testThrowsExceptionOnSettingNonStringHubServerUrl()
{
$this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
- $this->_publisher->addHubUrl(123);
+ $this->publisher->addHubUrl(123);
}
public function testThrowsExceptionOnSettingInvalidHubServerUrl()
{
$this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
- $this->_publisher->addHubUrl('http://');
+ $this->publisher->addHubUrl('http://');
}
public function testAddsUpdatedTopicUrl()
{
- $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
- $this->assertEquals(array('http://www.example.com/topic'), $this->_publisher->getUpdatedTopicUrls());
+ $this->publisher->addUpdatedTopicUrl('http://www.example.com/topic');
+ $this->assertEquals(array('http://www.example.com/topic'), $this->publisher->getUpdatedTopicUrls());
}
public function testAddsUpdatedTopicUrlsFromArray()
{
- $this->_publisher->addUpdatedTopicUrls(array(
+ $this->publisher->addUpdatedTopicUrls(array(
'http://www.example.com/topic', 'http://www.example.com/topic2'
));
$this->assertEquals(array(
'http://www.example.com/topic', 'http://www.example.com/topic2'
- ), $this->_publisher->getUpdatedTopicUrls());
+ ), $this->publisher->getUpdatedTopicUrls());
}
public function testAddsUpdatedTopicUrlsFromArrayUsingSetConfig()
{
- $this->_publisher->setOptions(array('updatedTopicUrls' => array(
+ $this->publisher->setOptions(array('updatedTopicUrls' => array(
'http://www.example.com/topic', 'http://www.example.com/topic2'
)));
$this->assertEquals(array(
'http://www.example.com/topic', 'http://www.example.com/topic2'
- ), $this->_publisher->getUpdatedTopicUrls());
+ ), $this->publisher->getUpdatedTopicUrls());
}
public function testRemovesUpdatedTopicUrl()
{
- $this->_publisher->addUpdatedTopicUrls(array(
+ $this->publisher->addUpdatedTopicUrls(array(
'http://www.example.com/topic', 'http://www.example.com/topic2'
));
- $this->_publisher->removeUpdatedTopicUrl('http://www.example.com/topic');
+ $this->publisher->removeUpdatedTopicUrl('http://www.example.com/topic');
$this->assertEquals(array(
1 => 'http://www.example.com/topic2'
- ), $this->_publisher->getUpdatedTopicUrls());
+ ), $this->publisher->getUpdatedTopicUrls());
}
public function testRetrievesUniqueUpdatedTopicUrlsOnly()
{
- $this->_publisher->addUpdatedTopicUrls(array(
+ $this->publisher->addUpdatedTopicUrls(array(
'http://www.example.com/topic', 'http://www.example.com/topic2',
'http://www.example.com/topic'
));
$this->assertEquals(array(
'http://www.example.com/topic', 'http://www.example.com/topic2'
- ), $this->_publisher->getUpdatedTopicUrls());
+ ), $this->publisher->getUpdatedTopicUrls());
}
public function testThrowsExceptionOnSettingEmptyUpdatedTopicUrl()
{
$this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
- $this->_publisher->addUpdatedTopicUrl('');
+ $this->publisher->addUpdatedTopicUrl('');
}
public function testThrowsExceptionOnSettingNonStringUpdatedTopicUrl()
{
$this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
- $this->_publisher->addUpdatedTopicUrl(123);
+ $this->publisher->addUpdatedTopicUrl(123);
}
public function testThrowsExceptionOnSettingInvalidUpdatedTopicUrl()
{
$this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
- $this->_publisher->addUpdatedTopicUrl('http://');
+ $this->publisher->addUpdatedTopicUrl('http://');
}
public function testAddsParameter()
{
- $this->_publisher->setParameter('foo', 'bar');
- $this->assertEquals(array('foo'=> 'bar'), $this->_publisher->getParameters());
+ $this->publisher->setParameter('foo', 'bar');
+ $this->assertEquals(array('foo'=> 'bar'), $this->publisher->getParameters());
}
public function testAddsParametersFromArray()
{
- $this->_publisher->setParameters(array(
+ $this->publisher->setParameters(array(
'foo' => 'bar', 'boo' => 'baz'
));
$this->assertEquals(array(
'foo' => 'bar', 'boo' => 'baz'
- ), $this->_publisher->getParameters());
+ ), $this->publisher->getParameters());
}
public function testAddsParametersFromArrayInSingleMethod()
{
- $this->_publisher->setParameter(array(
+ $this->publisher->setParameter(array(
'foo' => 'bar', 'boo' => 'baz'
));
$this->assertEquals(array(
'foo' => 'bar', 'boo' => 'baz'
- ), $this->_publisher->getParameters());
+ ), $this->publisher->getParameters());
}
public function testAddsParametersFromArrayUsingSetConfig()
{
- $this->_publisher->setOptions(array('parameters' => array(
+ $this->publisher->setOptions(array('parameters' => array(
'foo' => 'bar', 'boo' => 'baz'
)));
$this->assertEquals(array(
'foo' => 'bar', 'boo' => 'baz'
- ), $this->_publisher->getParameters());
+ ), $this->publisher->getParameters());
}
public function testRemovesParameter()
{
- $this->_publisher->setParameters(array(
+ $this->publisher->setParameters(array(
'foo' => 'bar', 'boo' => 'baz'
));
- $this->_publisher->removeParameter('boo');
+ $this->publisher->removeParameter('boo');
$this->assertEquals(array(
'foo' => 'bar'
- ), $this->_publisher->getParameters());
+ ), $this->publisher->getParameters());
}
public function testRemovesParameterIfSetToNull()
{
- $this->_publisher->setParameters(array(
+ $this->publisher->setParameters(array(
'foo' => 'bar', 'boo' => 'baz'
));
- $this->_publisher->setParameter('boo', null);
+ $this->publisher->setParameter('boo', null);
$this->assertEquals(array(
'foo' => 'bar'
- ), $this->_publisher->getParameters());
+ ), $this->publisher->getParameters());
}
public function testNotifiesHubWithCorrectParameters()
{
PubSubHubbub::setHttpClient($this->getClientSuccess());
$client = PubSubHubbub::getHttpClient();
- $this->_publisher->addHubUrl('http://www.example.com/hub');
- $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
- $this->_publisher->setParameter('foo', 'bar');
- $this->_publisher->notifyAll();
+ $this->publisher->addHubUrl('http://www.example.com/hub');
+ $this->publisher->addUpdatedTopicUrl('http://www.example.com/topic');
+ $this->publisher->setParameter('foo', 'bar');
+ $this->publisher->notifyAll();
$this->assertEquals('hub.mode=publish&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic&foo=bar',
$client->getRequest()->getContent());
}
@@ -266,10 +266,10 @@ public function testNotifiesHubWithCorrectParametersAndMultipleTopics()
{
PubSubHubbub::setHttpClient($this->getClientSuccess());
$client = PubSubHubbub::getHttpClient();
- $this->_publisher->addHubUrl('http://www.example.com/hub');
- $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
- $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic2');
- $this->_publisher->notifyAll();
+ $this->publisher->addHubUrl('http://www.example.com/hub');
+ $this->publisher->addUpdatedTopicUrl('http://www.example.com/topic');
+ $this->publisher->addUpdatedTopicUrl('http://www.example.com/topic2');
+ $this->publisher->notifyAll();
$this->assertEquals('hub.mode=publish&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic2',
$client->getRequest()->getContent());
}
@@ -278,22 +278,22 @@ public function testNotifiesHubAndReportsSuccess()
{
PubSubHubbub::setHttpClient($this->getClientSuccess());
$client = PubSubHubbub::getHttpClient();
- $this->_publisher->addHubUrl('http://www.example.com/hub');
- $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
- $this->_publisher->setParameter('foo', 'bar');
- $this->_publisher->notifyAll();
- $this->assertTrue($this->_publisher->isSuccess());
+ $this->publisher->addHubUrl('http://www.example.com/hub');
+ $this->publisher->addUpdatedTopicUrl('http://www.example.com/topic');
+ $this->publisher->setParameter('foo', 'bar');
+ $this->publisher->notifyAll();
+ $this->assertTrue($this->publisher->isSuccess());
}
public function testNotifiesHubAndReportsFail()
{
PubSubHubbub::setHttpClient($this->getClientFail());
$client = PubSubHubbub::getHttpClient();
- $this->_publisher->addHubUrl('http://www.example.com/hub');
- $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
- $this->_publisher->setParameter('foo', 'bar');
- $this->_publisher->notifyAll();
- $this->assertFalse($this->_publisher->isSuccess());
+ $this->publisher->addHubUrl('http://www.example.com/hub');
+ $this->publisher->addUpdatedTopicUrl('http://www.example.com/topic');
+ $this->publisher->setParameter('foo', 'bar');
+ $this->publisher->notifyAll();
+ $this->assertFalse($this->publisher->isSuccess());
}
}
Oops, something went wrong.

0 comments on commit e1db90c

Please sign in to comment.