Skip to content

Commit

Permalink
Merge pull request #31 from peter279k/test_enhancement
Browse files Browse the repository at this point in the history
test hancement
  • Loading branch information
jenssegers committed Apr 3, 2018
2 parents 005c906 + ea80f19 commit fc4ef4e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,8 @@ php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm

sudo: false
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Expand Up @@ -21,6 +21,9 @@
"phpunit/phpunit": "^4.0|^5.0",
"satooshi/php-coveralls": "^0.6"
},
"suggest": {
"ext-gmp": "It can speed up the image hash."
},
"autoload": {
"psr-4": {
"Jenssegers\\ImageHash\\": "src"
Expand Down
5 changes: 5 additions & 0 deletions phpunit.xml
Expand Up @@ -14,4 +14,9 @@
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
9 changes: 3 additions & 6 deletions tests/ImageHashTest.php
@@ -1,8 +1,9 @@
<?php

use Jenssegers\ImageHash\ImageHash;
use PHPUnit\Framework\TestCase;

class ImageHashTest extends PHPUnit_Framework_TestCase
class ImageHashTest extends TestCase
{
/**
* @var ImageHash
Expand All @@ -16,11 +17,7 @@ public function setup()

public function testHashStringInvalidFile()
{
if (method_exists($this, 'expectException')) {
$this->expectException('InvalidArgumentException');
} else {
$this->setExpectedException('InvalidArgumentException');
}
$this->setExpectedException('InvalidArgumentException');

$this->imageHash->hashFromString('nonImageString');
}
Expand Down
11 changes: 2 additions & 9 deletions tests/ImageTest.php
Expand Up @@ -5,8 +5,9 @@
use Jenssegers\ImageHash\Implementations\AverageHash;
use Jenssegers\ImageHash\Implementations\DifferenceHash;
use Jenssegers\ImageHash\Implementations\PerceptualHash;
use PHPUnit\Framework\TestCase;

class ImageTest extends PHPUnit_Framework_TestCase
class ImageTest extends TestCase
{
/**
* @var Implementation[]
Expand Down Expand Up @@ -154,12 +155,4 @@ public function testDecimalMode()
$this->assertTrue(is_int($hash), $hash);
$this->assertEquals(0, $imageHash->distance($hash, $hash));
}

// public function testThrowsUnexceptedValueException()
// {
// $this->setExpectedException('UnexpectedValueException');

// $imageHash = new ImageHash;
// $imageHash->distance("a", "b");
// }
}

0 comments on commit fc4ef4e

Please sign in to comment.