1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-02 10:23:29 +02:00

Add test for Profile::class

This commit is contained in:
Oliver Vogel
2025-01-02 16:18:54 +01:00
parent c7ec22602c
commit 116bd03bc6
2 changed files with 30 additions and 1 deletions

View File

@@ -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'));
}
}

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Colors;
use Intervention\Image\Colors\Profile;
use Intervention\Image\Tests\BaseTestCase;
class ProfileTest extends BaseTestCase
{
public function testFromPath(): void
{
$profile = Profile::fromPath($this->getTestResourcePath());
$this->assertInstanceOf(Profile::class, $profile);
$this->assertTrue($profile->size() > 0);
}
}