Completed
Pull Request — master (#203)
by Alister
09:00
created

MockProviderTest::testGetContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Debril\RssAtomBundle\Tests\Provider;
4
5
use Debril\RssAtomBundle\Provider\MockProvider;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\HttpFoundation\Request;
8
9
/**
10
 * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-01-25 at 23:47:50.
11
 */
12
class MockProviderTest extends TestCase
13
{
14
    /**
15
     * @var MockProvider
16
     */
17
    protected $object;
18
19
    /**
20
     * Sets up the fixture, for example, opens a network connection.
21
     * This method is called before a test is executed.
22
     */
23
    protected function setUp()
24
    {
25
        $this->object = new MockProvider();
26
    }
27
28
    /**
29
     * Tears down the fixture, for example, closes a network connection.
30
     * This method is called after a test is executed.
31
     */
32
    protected function tearDown()
33
    {
34
    }
35
36
    /**
37
     * @covers Debril\RssAtomBundle\Provider\MockProvider::getFeed
38
     */
39
    public function testGetContent()
40
    {
41
        $request = new Request(['id' => 'some-id']);
42
        $feed = $this->object->getFeed($request);
43
44
        $this->assertInstanceOf('FeedIo\FeedInterface', $feed);
45
    }
46
47
    /**
48
     * @covers Debril\RssAtomBundle\Provider\MockProvider::getFeed
49
     * @expectedException \Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException
50
     */
51
    public function testGet404()
52
    {
53
        $request = new Request(['id' => 'not-found']);
54
        $feed = $this->object->getFeed($request);
0 ignored issues
show
Unused Code introduced by
$feed 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...
55
56
        $this->object->getFeed($request);
57
    }
58
}
59