Completed
Push — master ( e60a6a...7a7a1d )
by Mia
03:34 queued 12s
created

CRSSFeedTest::testGetFeed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 14 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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
Unused Code introduced by
$matcher 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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
35
		'tag' => 'h1', 'content' => 'regexp:/<h1>.*<\/h1>/',
36
		'parent' => array('tag' => 'article')
37
		);
38
		 
39
		$matchFeed = array(
0 ignored issues
show
Unused Code introduced by
$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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

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
}