mirror of
https://github.com/Intervention/image.git
synced 2025-08-26 15:24:37 +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:
58
tests/Unit/Geometry/EllipseTest.php
Normal file
58
tests/Unit/Geometry/EllipseTest.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Geometry;
|
||||
|
||||
use Intervention\Image\Geometry\Ellipse;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
|
||||
final class EllipseTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertInstanceOf(Ellipse::class, $ellipse);
|
||||
$this->assertEquals(10, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
}
|
||||
|
||||
public function testPosition(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertInstanceOf(Point::class, $ellipse->position());
|
||||
$this->assertEquals(100, $ellipse->position()->x());
|
||||
$this->assertEquals(200, $ellipse->position()->y());
|
||||
|
||||
$this->assertInstanceOf(Point::class, $ellipse->pivot());
|
||||
$this->assertEquals(100, $ellipse->pivot()->x());
|
||||
$this->assertEquals(200, $ellipse->pivot()->y());
|
||||
}
|
||||
|
||||
public function testSetSize(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertEquals(10, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
$result = $ellipse->setSize(100, 200);
|
||||
$this->assertInstanceOf(Ellipse::class, $result);
|
||||
$this->assertEquals(100, $ellipse->width());
|
||||
$this->assertEquals(200, $ellipse->height());
|
||||
}
|
||||
|
||||
public function testSetWidthHeight(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertEquals(10, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
$result = $ellipse->setWidth(100);
|
||||
$this->assertInstanceOf(Ellipse::class, $result);
|
||||
$this->assertEquals(100, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
$result = $ellipse->setHeight(200);
|
||||
$this->assertInstanceOf(Ellipse::class, $result);
|
||||
$this->assertEquals(100, $ellipse->width());
|
||||
$this->assertEquals(200, $ellipse->height());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user