Add the method Image\PerceptualHash::version()

This commit is contained in:
travail 2015-10-09 18:20:27 +09:00
parent b357936a84
commit 9a411b5087
2 changed files with 18 additions and 0 deletions

View File

@ -10,6 +10,8 @@ use Image\PerceptualHash\Algorithm\AverageHash;
use Image\PerceptualHash\Exception\FileNotFoundException;
class PerceptualHash {
const VERSION = '0.1.0';
/**
* @var Algorithm Instance of Algorithm
*/
@ -39,6 +41,14 @@ class PerceptualHash {
$this->hex = $this->algorithm->hex($this->bin);
}
/**
* @return string The version of Image\PerceptualHash.
*/
public static function version()
{
return (string) self::VERSION;
}
/**
* Returns binary hash.
*

View File

@ -16,6 +16,14 @@ class BasicTest extends PHPUnit_Framework_TestCase
$this->bin_inuo2 = '1111011111110011000000100000000011000011110000111100001111111111';
}
public function testVersion()
{
$version = PerceptualHash::version();
$this->assertTrue(isset($version));
$this->assertTrue(is_string($version));
$this->assertSame(PerceptualHash::VERSION, $version);
}
public function testLoad()
{
try {