mirror of
https://github.com/Intervention/image.git
synced 2025-09-02 02:12:37 +02:00
Add type hints in tests
This commit is contained in:
@@ -16,17 +16,17 @@ use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
abstract class BaseTestCase extends MockeryTestCase
|
||||
{
|
||||
public static function getTestResourcePath($filename = 'test.jpg'): string
|
||||
public static function getTestResourcePath(string $filename = 'test.jpg'): string
|
||||
{
|
||||
return sprintf('%s/resources/%s', __DIR__, $filename);
|
||||
}
|
||||
|
||||
public static function getTestResourceData($filename = 'test.jpg'): string
|
||||
public static function getTestResourceData(string $filename = 'test.jpg'): string
|
||||
{
|
||||
return file_get_contents(self::getTestResourcePath($filename));
|
||||
}
|
||||
|
||||
public static function getTestResourcePointer($filename = 'test.jpg')
|
||||
public static function getTestResourcePointer(string $filename = 'test.jpg'): mixed
|
||||
{
|
||||
$pointer = fopen('php://temp', 'rw');
|
||||
fwrite($pointer, self::getTestResourceData($filename));
|
||||
@@ -39,9 +39,8 @@ abstract class BaseTestCase extends MockeryTestCase
|
||||
* Assert that given color equals the given color channel values in the given optional tolerance
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @return void
|
||||
*/
|
||||
protected function assertColor(int $r, int $g, int $b, int $a, ColorInterface $color, int $tolerance = 0)
|
||||
protected function assertColor(int $r, int $g, int $b, int $a, ColorInterface $color, int $tolerance = 0): void
|
||||
{
|
||||
// build errorMessage
|
||||
$errorMessage = function (int $r, int $g, $b, int $a, ColorInterface $color): string {
|
||||
@@ -90,7 +89,7 @@ abstract class BaseTestCase extends MockeryTestCase
|
||||
);
|
||||
}
|
||||
|
||||
protected function assertTransparency(ColorInterface $color)
|
||||
protected function assertTransparency(ColorInterface $color): void
|
||||
{
|
||||
$this->assertInstanceOf(RgbColor::class, $color);
|
||||
$channel = $color->channel(Alpha::class);
|
||||
|
Reference in New Issue
Block a user