miarau /
rssfeed
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * A test class for testing RSSFeed class |
||
| 4 | * |
||
| 5 | */ |
||
| 6 | |||
| 7 | namespace Miax\RSSFeed; |
||
| 8 | use SimplePie; |
||
| 9 | use Miax\RSSFeed\CRSSFeed; |
||
| 10 | require_once(__DIR__."/../../src/RSSFeed/simplepie/simplepie_1.3.1.mini.php"); |
||
| 11 | require_once(__DIR__."/../../src/RSSFeed/CRSSFeed.php"); |
||
| 12 | |||
| 13 | |||
| 14 | class CRSSFeedTest extends \PHPUnit_Framework_TestCase { |
||
| 15 | |||
| 16 | |||
| 17 | /** ------------------------------------------------------- |
||
| 18 | * Test 1a |
||
| 19 | * |
||
| 20 | */ |
||
| 21 | |||
| 22 | |||
| 23 | private $feed; |
||
| 24 | |||
| 25 | |||
| 26 | public function setUp(){ |
||
| 27 | $rss = new SimplePie(); |
||
| 28 | $rss->get_items(1,1); |
||
| 29 | $this->feed = new CRSSFeed($rss); |
||
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | public function testAssertTags(){ |
||
| 34 | $matcher = array( |
||
|
0 ignored issues
–
show
|
|||
| 35 | 'tag' => 'h1', 'content' => 'regexp:/<h1>.*<\/h1>/', |
||
| 36 | 'parent' => array('tag' => 'article') |
||
| 37 | ); |
||
| 38 | |||
| 39 | $matchFeed = array( |
||
|
0 ignored issues
–
show
$matchFeed is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 40 | 'tag'=> 'h2', 'content' => 'regexp:/<h2>.*<\/h2>/', |
||
| 41 | 'tag'=> 'small', 'content' => 'regexp:/<small>.*<\/small>/', |
||
| 42 | 'tag'=> 'p', 'content' => 'regexp:/<p>.*<\/p>/', |
||
| 43 | 'parent' => array('tag' => 'div', 'attributes' => array('class' => 'feed-content')) |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | public function testGetFeed(){ |
||
| 49 | $this->assertInternalType('string', 'regexp:/<article>.*<\/article>/'); |
||
| 50 | } |
||
| 51 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.