1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 20:28:21 +01:00
intervention_image/tests/TestCase.php
2023-10-19 17:44:18 +02:00

32 lines
894 B
PHP

<?php
namespace Intervention\Image\Tests;
use Intervention\Image\Colors\Rgb\Color as RgbColor;
use Intervention\Image\Interfaces\ColorInterface;
use Mockery\Adapter\Phpunit\MockeryTestCase;
abstract class TestCase extends MockeryTestCase
{
public function getTestImagePath($filename = 'test.jpg'): string
{
return sprintf('%s/images/%s', __DIR__, $filename);
}
public function getTestImageData($filename = 'test.jpg'): string
{
return file_get_contents($this->getTestImagePath($filename));
}
protected function assertColor($r, $g, $b, $a, ColorInterface $color)
{
$this->assertEquals([$r, $g, $b, $a], $color->toArray());
}
protected function assertTransparency(ColorInterface $color)
{
$this->assertInstanceOf(RgbColor::class, $color);
$this->assertEquals(0, $color->toRgb()->alpha()->value());
}
}