1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-26 15:24:37 +02:00

Externalize data provider

This commit is contained in:
Oliver Vogel
2025-08-01 17:30:09 +02:00
parent dd1e8448c7
commit 60209b8f8f
5 changed files with 131 additions and 80 deletions

View File

@@ -11,29 +11,13 @@ use Intervention\Image\Colors\Rgb\Channels\Red;
use Intervention\Image\Colors\Rgb\Color as RgbColor;
use Intervention\Image\EncodedImage;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Tests\Traits\CanGenerateTestData;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use PHPUnit\Framework\ExpectationFailedException;
abstract class BaseTestCase extends MockeryTestCase
{
public static function getTestResourcePath(string $filename = 'test.jpg'): string
{
return sprintf('%s/resources/%s', __DIR__, $filename);
}
public static function getTestResourceData(string $filename = 'test.jpg'): string
{
return file_get_contents(self::getTestResourcePath($filename));
}
public static function getTestResourcePointer(string $filename = 'test.jpg'): mixed
{
$pointer = fopen('php://temp', 'rw');
fwrite($pointer, self::getTestResourceData($filename));
rewind($pointer);
return $pointer;
}
use CanGenerateTestData;
/**
* Assert that given color equals the given color channel values in the given optional tolerance