mirror of
https://github.com/Intervention/image.git
synced 2025-01-29 17:57:50 +01:00
33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Intervention\Image\Tests\Geometry\Factories;
|
|
|
|
use Intervention\Image\Geometry\Factories\LineFactory;
|
|
use Intervention\Image\Geometry\Line;
|
|
use Intervention\Image\Tests\TestCase;
|
|
|
|
class LineFactoryTest extends TestCase
|
|
{
|
|
public function testFactoryCallback(): void
|
|
{
|
|
$factory = new LineFactory(function ($line) {
|
|
$line->color('fff');
|
|
$line->background('fff');
|
|
$line->border('fff', 10);
|
|
$line->width(10);
|
|
$line->from(100, 200);
|
|
$line->to(300, 400);
|
|
});
|
|
|
|
$line = $factory();
|
|
$this->assertInstanceOf(Line::class, $line);
|
|
$this->assertTrue($line->hasBackgroundColor());
|
|
$this->assertEquals('fff', $line->backgroundColor());
|
|
$this->assertEquals(100, $line->start()->x());
|
|
$this->assertEquals(200, $line->start()->y());
|
|
$this->assertEquals(300, $line->end()->x());
|
|
$this->assertEquals(400, $line->end()->y());
|
|
$this->assertEquals(10, $line->width());
|
|
}
|
|
}
|