mirror of
https://github.com/Intervention/image.git
synced 2025-08-27 15:50:09 +02:00
Improve Driver Specializing Process (#1315)
Streamline driver specializing process of analyzers, modifers, encoders and decoders.
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Modifiers;
|
||||
|
||||
use Intervention\Image\Modifiers\SpecializableModifier;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
use Mockery;
|
||||
|
||||
final class SpecializableModifierTest extends BaseTestCase
|
||||
{
|
||||
public function testApply(): void
|
||||
{
|
||||
$modifier = Mockery::mock(SpecializableModifier::class)->makePartial();
|
||||
$image = Mockery::mock(ImageInterface::class);
|
||||
$image->shouldReceive('modify')->andReturn($image);
|
||||
|
||||
$result = $modifier->apply($image);
|
||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||
}
|
||||
}
|
38
tests/Unit/Modifiers/TextModifierTest.php
Normal file
38
tests/Unit/Modifiers/TextModifierTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Modifiers;
|
||||
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Modifiers\TextModifier;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
use Intervention\Image\Typography\Font;
|
||||
|
||||
final class TextModifierTest extends BaseTestCase
|
||||
{
|
||||
public function testStrokeOffsets(): void
|
||||
{
|
||||
$modifier = new class ('test', new Point(), new Font()) extends TextModifier
|
||||
{
|
||||
public function testStrokeOffsets($font)
|
||||
{
|
||||
return $this->strokeOffsets($font);
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertEquals([], $modifier->testStrokeOffsets(new Font()));
|
||||
|
||||
$this->assertEquals([
|
||||
new Point(-1, -1),
|
||||
new Point(-1, 0),
|
||||
new Point(-1, 1),
|
||||
new Point(0, -1),
|
||||
new Point(0, 0),
|
||||
new Point(0, 1),
|
||||
new Point(1, -1),
|
||||
new Point(1, 0),
|
||||
new Point(1, 1),
|
||||
], $modifier->testStrokeOffsets((new Font())->setStrokeWidth(1)));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user