for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PackageInfoTest\Unit;
use PHPUnit_Framework_TestCase;
use PackageInfo\Package;
/**
* @covers \PackageInfo\Package
*/
class PackageTest extends PHPUnit_Framework_TestCase
{
* @expectedException \PackageInfo\Exception\PackageNotInstalledException
* @expectedExceptionMessage Package "vendor/something" is not installed through composer, or you installed it with the flag --no-scripts
public function testConstruct()
$package = new Package('vendor/something');
$package
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
}
public function testIsInstalled()
$bool = Package::isInstalled('vendor/something');
$this->assertFalse($bool);
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.