mirror of
https://github.com/Intervention/image.git
synced 2025-08-26 07:14:31 +02:00
PHPUnit 10 Migration (#1302)
* Bump PHPUnit dependencies * Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html * Ignore PHPUnit cache folder * Adopt PHP attributes in test classes * Declare data providers as `static` * Add return types to test methods * Define test classes as `final` * Migrate phpunit.xml to phpunit 10 * Correct phpunit attribute class name * Rename base test class * Restructure test folders * Fix test image paths * Only set rules for php files in .editorconfig * Remove php unit flag in local test env --------- Co-authored-by: Shift <shift@laravelshift.com>
This commit is contained in:
57
tests/Unit/Geometry/Traits/HasBorderTest.php
Normal file
57
tests/Unit/Geometry/Traits/HasBorderTest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Geometry\Traits;
|
||||
|
||||
use Intervention\Image\Geometry\Traits\HasBorder;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
|
||||
final class HasBorderTest extends BaseTestCase
|
||||
{
|
||||
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