for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Debril\RssAtomBundle\Tests\Provider;
use Debril\RssAtomBundle\Provider\MockProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
/**
* Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-01-25 at 23:47:50.
*/
class MockProviderTest extends TestCase
{
* @var MockProvider
protected $object;
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
protected function setUp()
$this->object = new MockProvider();
}
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
protected function tearDown()
* @covers Debril\RssAtomBundle\Provider\MockProvider::getFeed
public function testGetContent()
$request = new Request(['id' => 'some-id']);
$feed = $this->object->getFeed($request);
$this->assertInstanceOf('FeedIo\FeedInterface', $feed);
* @expectedException \Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException
public function testGet404()
$request = new Request(['id' => 'not-found']);
$feed
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.
$myVar
$higher
$this->object->getFeed($request);
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
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.