39 lines
		
	
	
		
			870 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			870 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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());
 | 
						|
    }
 | 
						|
} |