mirror of
https://github.com/Intervention/image.git
synced 2025-08-17 19:26:25 +02:00
Add Geometry traits tests
This commit is contained in:
26
tests/Geometry/Traits/HasBackgroundColor.php
Normal file
26
tests/Geometry/Traits/HasBackgroundColor.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Intervention\Image\Tests\Geometry\Traits;
|
||||||
|
|
||||||
|
use Intervention\Image\Geometry\Traits\HasBackgroundColor;
|
||||||
|
use Intervention\Image\Tests\TestCase;
|
||||||
|
|
||||||
|
class HasBackgroundColorTest extends TestCase
|
||||||
|
{
|
||||||
|
public function getTestObject(): object
|
||||||
|
{
|
||||||
|
return new class () {
|
||||||
|
use HasBackgroundColor;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetGetBackgroundColor(): void
|
||||||
|
{
|
||||||
|
$object = $this->getTestObject();
|
||||||
|
$this->assertNull($object->backgroundColor());
|
||||||
|
$this->assertFalse($object->hasBackgroundColor());
|
||||||
|
$object->setBackgroundColor('fff');
|
||||||
|
$this->assertEquals('fff', $object->backgroundColor());
|
||||||
|
$this->assertTrue($object->hasBackgroundColor());
|
||||||
|
}
|
||||||
|
}
|
55
tests/Geometry/Traits/HasBorderTest.php
Normal file
55
tests/Geometry/Traits/HasBorderTest.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Intervention\Image\Tests\Geometry\Traits;
|
||||||
|
|
||||||
|
use Intervention\Image\Geometry\Traits\HasBorder;
|
||||||
|
use Intervention\Image\Tests\TestCase;
|
||||||
|
|
||||||
|
class HasBorderTest extends TestCase
|
||||||
|
{
|
||||||
|
public function getTestObject(): object
|
||||||
|
{
|
||||||
|
return new class () {
|
||||||
|
use HasBorder;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetBorder(): void
|
||||||
|
{
|
||||||
|
$object = $this->getTestObject();
|
||||||
|
$this->assertNull($object->borderColor());
|
||||||
|
$this->assertEquals(0, $object->borderSize());
|
||||||
|
$this->assertFalse($object->hasBorder());
|
||||||
|
$object->setBorder('fff', 10);
|
||||||
|
$this->assertEquals('fff', $object->borderColor());
|
||||||
|
$this->assertEquals(10, $object->borderSize());
|
||||||
|
$this->assertTrue($object->hasBorder());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetBorderSize(): void
|
||||||
|
{
|
||||||
|
$object = $this->getTestObject();
|
||||||
|
$this->assertEquals(0, $object->borderSize());
|
||||||
|
$object->setBorderSize(10);
|
||||||
|
$this->assertEquals(10, $object->borderSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetBorderColor(): void
|
||||||
|
{
|
||||||
|
$object = $this->getTestObject();
|
||||||
|
$this->assertNull($object->borderColor());
|
||||||
|
$object->setBorderColor('fff');
|
||||||
|
$this->assertEquals('fff', $object->borderColor());
|
||||||
|
$this->assertFalse($object->hasBorder());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHasBorder(): void
|
||||||
|
{
|
||||||
|
$object = $this->getTestObject();
|
||||||
|
$this->assertFalse($object->hasBorder());
|
||||||
|
$object->setBorderColor('fff');
|
||||||
|
$this->assertFalse($object->hasBorder());
|
||||||
|
$object->setBorderSize(1);
|
||||||
|
$this->assertTrue($object->hasBorder());
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user