Initial commit

This commit is contained in:
2018-04-15 16:41:46 +02:00
commit 86ff40274b
29 changed files with 1368 additions and 0 deletions

39
tests/Key/FileKeyTest.php Normal file
View 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());
}
}