Skip to content

Commit f95e0a7

Browse files
committed
Fix strict notice under php 5.5
1 parent b58c51a commit f95e0a7

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

lib/Creator/FeedCreator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,11 @@ function version()
8383
* If the string is truncated, " ..." is appended.
8484
* If the string is already shorter than $length, it is returned unchanged.
8585
*
86-
* @static
8786
* @param string string A string to be truncated.
8887
* @param int length the maximum length the string should be truncated to
8988
* @return string the truncated string
9089
*/
91-
function iTrunc($string, $length) {
90+
public static function iTrunc($string, $length) {
9291
if (strlen($string)<=$length) {
9392
return $string;
9493
}
@@ -150,7 +149,7 @@ function _createStylesheetReferences() {
150149

151150
/**
152151
* Builds the feed's text.
153-
*
152+
*
154153
* @return string the feed's complete text
155154
*/
156155
abstract function createFeed();

test/UniversalFeedCreatorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ public function test_createFeed_rss($format, $expected)
2121
$this->assertEquals($expected->channel->generator, $actual->channel->generator);
2222
}
2323

24+
public function test_createFeed()
25+
{
26+
$creator = new UniversalFeedCreator;
27+
$creator->description = 'Feed Description';
28+
$creator->addItem(new FeedItem());
29+
$feed = $creator->createFeed('RSS2.0');
30+
31+
$expected = simplexml_load_file(__DIR__ . DIRECTORY_SEPARATOR . '__files' . DIRECTORY_SEPARATOR . 'rss091.xml');
32+
$actual = simplexml_load_string($feed);
33+
$this->assertEquals($expected->channel->description, $actual->channel->description);
34+
}
35+
2436
public function provider_createFeed()
2537
{
2638
return array

test/__files/rss091.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- generator="FeedCreator 1.8" -->
3+
<rss version="0.91">
4+
<channel xmlns:g="http://base.google.com/ns/1.0">
5+
<title>Feed Title</title>
6+
<description>Feed Description</description>
7+
<link>http://link.to/blog</link>
8+
<lastBuildDate>Tue, 12 Mar 2013 22:05:51 +0000</lastBuildDate>
9+
<generator>FeedCreator 1.8</generator>
10+
<item>
11+
<title>Item Title</title>
12+
<link>http://link.to/somewhere</link>
13+
<description>Item Description</description>
14+
</item>
15+
</channel>
16+
</rss>

0 commit comments

Comments
 (0)