Tests are our examples, using images as test material

This commit is contained in:
Ismo Vuorinen
2017-09-14 14:24:44 +03:00
parent aab19fa5b3
commit 23062bdcc0
6 changed files with 15 additions and 76 deletions

View File

@@ -30,6 +30,21 @@ class PaletteTest extends \PHPUnit_Framework_TestCase
}
}
public function test_known_images_with_many_colors()
{
$location = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR;
$images = ['example.gif', 'example.jpg', 'example.png'];
foreach ($images as $imageFile) {
$image = $location . $imageFile;
$this->assertFileExists($image);
$palette = new \ivuorinen\Palette\Palette($image);
$this->assertCount(10, $palette->colorsArray);
$this->assertEquals($image, $palette->filename);
}
}
public function test_failure_no_image()
{
$palette = new \ivuorinen\Palette\Palette('');