for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Chris Hilsdon <[email protected]>
*/
namespace Xigen\Tests;
use Xigen\ComodoDecodeCSR;
class ComodoDecodeCSRTest extends XigenUnit
{
private $validMD5 = "98EB197EF83F7A9EB736ED7CEBD413CE";
private $validSHA1 = "DA9C72B6F6BCB05772BF8543E19D1A41B0210E84";
public function setUp()
$this->ComodoDecodeCSR = new ComodoDecodeCSR();
}
public function testSettingCSR()
//Load the test CSR
$csr = $this->loadTestCSR();
$this->ComodoDecodeCSR->setCSR($csr);
$this->assertSame(
$csr,
$this->ComodoDecodeCSR->getCSR(),
"Unable to set the CSR via ->setCSR()"
);
public function testGettingHashes()
$Hashes = $this->ComodoDecodeCSR->fetchHashes();
$this->assertSame($this->validMD5, $Hashes["md5"], "md5 didn't match the correct value");
$this->assertSame($this->validSHA1, $Hashes["sha1"], "sha1 didn't match the correct value");
public function testCheckingInstalled()
$Hashes
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
$Installed = $this->ComodoDecodeCSR->checkInstalled();
$this->assertTrue($Installed);
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.