mirror of
https://github.com/ivuorinen/palette.git
synced 2026-02-12 20:50:06 +00:00
Now actually running tests, dropping PHP5.5
This commit is contained in:
32
tests/PaletteTest.php
Normal file
32
tests/PaletteTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class PaletteTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_class_is_found_and_has_default_attributes()
|
||||
{
|
||||
$palette = new \ivuorinen\Palette\Palette();
|
||||
$this->assertInstanceOf('ivuorinen\Palette\Palette', $palette);
|
||||
|
||||
$this->assertInternalType('integer', $palette->precision);
|
||||
$this->assertInternalType('integer', $palette->returnColors);
|
||||
$this->assertInternalType('array', $palette->colorsArray);
|
||||
$this->assertInternalType('null', $palette->filename);
|
||||
$this->assertInternalType('string', $palette->destination);
|
||||
}
|
||||
|
||||
public function test_known_images()
|
||||
{
|
||||
$location = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR;
|
||||
$images = ['black.png' => '000000', 'red.png' => 'CC3333'];
|
||||
|
||||
foreach ($images as $imageFile => $hex) {
|
||||
$image = $location . $imageFile;
|
||||
$this->assertTrue(file_exists($image));
|
||||
|
||||
$palette = new \ivuorinen\Palette\Palette($image);
|
||||
$this->assertCount(1, $palette->colorsArray);
|
||||
$this->assertArrayHasKey($hex, $palette->colorsArray);
|
||||
$this->assertEquals($image, $palette->filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user