mirror of
https://github.com/Intervention/image.git
synced 2025-09-03 02:42:45 +02:00
Add test for Profile::class
This commit is contained in:
@@ -5,9 +5,20 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Colors;
|
namespace Intervention\Image\Colors;
|
||||||
|
|
||||||
use Intervention\Image\File;
|
use Intervention\Image\File;
|
||||||
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\ProfileInterface;
|
use Intervention\Image\Interfaces\ProfileInterface;
|
||||||
|
|
||||||
class Profile extends File implements 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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
18
tests/Unit/Colors/ProfileTest.php
Normal file
18
tests/Unit/Colors/ProfileTest.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user