From 116bd03bc6e2306219ac66c927d49f3e16f5f446 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Thu, 2 Jan 2025 16:18:54 +0100 Subject: [PATCH] Add test for Profile::class --- src/Colors/Profile.php | 13 ++++++++++++- tests/Unit/Colors/ProfileTest.php | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/Unit/Colors/ProfileTest.php diff --git a/src/Colors/Profile.php b/src/Colors/Profile.php index b6383509..c8bc1209 100644 --- a/src/Colors/Profile.php +++ b/src/Colors/Profile.php @@ -5,9 +5,20 @@ declare(strict_types=1); namespace Intervention\Image\Colors; use Intervention\Image\File; +use Intervention\Image\Exceptions\RuntimeException; use Intervention\Image\Interfaces\ProfileInterface; class Profile extends File implements ProfileInterface { - // + /** + * Create profile object from path in file system + * + * @param string $path + * @throws RuntimeException + * @return Profile + */ + public static function fromPath(string $path): self + { + return new self(fopen($path, 'r')); + } } diff --git a/tests/Unit/Colors/ProfileTest.php b/tests/Unit/Colors/ProfileTest.php new file mode 100644 index 00000000..200eb559 --- /dev/null +++ b/tests/Unit/Colors/ProfileTest.php @@ -0,0 +1,18 @@ +getTestResourcePath()); + $this->assertInstanceOf(Profile::class, $profile); + $this->assertTrue($profile->size() > 0); + } +}