Skip to content

Commit

Permalink
Fix strict notice under php 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Nov 10, 2013
1 parent b58c51a commit f95e0a7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Creator/FeedCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ function version()
* If the string is truncated, " ..." is appended.
* If the string is already shorter than $length, it is returned unchanged.
*
* @static
* @param string string A string to be truncated.
* @param int length the maximum length the string should be truncated to
* @return string the truncated string
*/
function iTrunc($string, $length) {
public static function iTrunc($string, $length) {
if (strlen($string)<=$length) {
return $string;
}
Expand Down Expand Up @@ -150,7 +149,7 @@ function _createStylesheetReferences() {

/**
* Builds the feed's text.
*
*
* @return string the feed's complete text
*/
abstract function createFeed();
Expand Down
12 changes: 12 additions & 0 deletions test/UniversalFeedCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ public function test_createFeed_rss($format, $expected)
$this->assertEquals($expected->channel->generator, $actual->channel->generator);
}

public function test_createFeed()
{
$creator = new UniversalFeedCreator;
$creator->description = 'Feed Description';
$creator->addItem(new FeedItem());
$feed = $creator->createFeed('RSS2.0');

$expected = simplexml_load_file(__DIR__ . DIRECTORY_SEPARATOR . '__files' . DIRECTORY_SEPARATOR . 'rss091.xml');
$actual = simplexml_load_string($feed);
$this->assertEquals($expected->channel->description, $actual->channel->description);
}

public function provider_createFeed()
{
return array
Expand Down
16 changes: 16 additions & 0 deletions test/__files/rss091.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<rss version="0.91">
<channel xmlns:g="http://base.google.com/ns/1.0">
<title>Feed Title</title>
<description>Feed Description</description>
<link>http://link.to/blog</link>
<lastBuildDate>Tue, 12 Mar 2013 22:05:51 +0000</lastBuildDate>
<generator>FeedCreator 1.8</generator>
<item>
<title>Item Title</title>
<link>http://link.to/somewhere</link>
<description>Item Description</description>
</item>
</channel>
</rss>

0 comments on commit f95e0a7

Please sign in to comment.