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-21 09:25:36 +02:00

33 lines
946 B
PHP

<?php
namespace Intervention\Image\Tests;
use Intervention\Image\Colors\Rgb\Color;
use Intervention\Image\Colors\Rgb\Colorspace;
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(Color::class, $color);
$this->assertEquals(0, $color->convertTo(Colorspace::class)->alpha()->value());
}
}