Initial commit
This commit is contained in:
39
tests/Key/FileKeyTest.php
Normal file
39
tests/Key/FileKeyTest.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Ipc\Key;
|
||||
|
||||
class FileKeyTest extends \PhpUnit\Framework\TestCase
|
||||
{
|
||||
public function testKeyGenerationFromExistingFile()
|
||||
{
|
||||
$keyfile = new FileKey(__FILE__);
|
||||
|
||||
$key = $keyfile->getKey();
|
||||
|
||||
$this->assertGreaterThan(0, $key);
|
||||
}
|
||||
|
||||
public function testKeyGenerationFromTemporaryFile()
|
||||
{
|
||||
$tempfile = "/tmp/key.tmp";
|
||||
file_exists($tempfile) && unlink($tempfile);
|
||||
|
||||
$keyfile = new FileKey($tempfile, "a", true);
|
||||
|
||||
$key = $keyfile->getKey();
|
||||
|
||||
$this->assertGreaterThan(0, $key);
|
||||
|
||||
}
|
||||
|
||||
public function testCloningShouldIncreaseProject()
|
||||
{
|
||||
$keyfile = new FileKey(__FILE__, "a");
|
||||
|
||||
$this->assertEquals("a", $keyfile->getProjectIdentifier());
|
||||
|
||||
$keyfile2 = clone $keyfile;
|
||||
|
||||
$this->assertEquals("b", $keyfile2->getProjectIdentifier());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user