mirror of
https://github.com/Intervention/image.git
synced 2025-09-01 01:51:43 +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:
61
tests/Unit/Typography/LineTest.php
Normal file
61
tests/Unit/Typography/LineTest.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Typography;
|
||||
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
use Intervention\Image\Typography\Line;
|
||||
|
||||
final class LineTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$line = new Line('foo');
|
||||
$this->assertInstanceOf(Line::class, $line);
|
||||
}
|
||||
|
||||
public function testToString(): void
|
||||
{
|
||||
$line = new Line('foo bar');
|
||||
$this->assertEquals('foo bar', (string) $line);
|
||||
}
|
||||
|
||||
public function testSetGetPosition(): void
|
||||
{
|
||||
$line = new Line('foo');
|
||||
$this->assertEquals(0, $line->position()->x());
|
||||
$this->assertEquals(0, $line->position()->y());
|
||||
|
||||
$line->setPosition(new Point(10, 11));
|
||||
$this->assertEquals(10, $line->position()->x());
|
||||
$this->assertEquals(11, $line->position()->y());
|
||||
}
|
||||
|
||||
public function testCount(): void
|
||||
{
|
||||
$line = new Line();
|
||||
$this->assertEquals(0, $line->count());
|
||||
|
||||
$line = new Line("foo");
|
||||
$this->assertEquals(1, $line->count());
|
||||
|
||||
$line = new Line("foo bar");
|
||||
$this->assertEquals(2, $line->count());
|
||||
}
|
||||
|
||||
public function testAdd(): void
|
||||
{
|
||||
$line = new Line();
|
||||
$this->assertEquals(0, $line->count());
|
||||
|
||||
$result = $line->add('foo');
|
||||
$this->assertEquals(1, $line->count());
|
||||
$this->assertEquals(1, $result->count());
|
||||
|
||||
$result = $line->add('bar');
|
||||
$this->assertEquals(2, $line->count());
|
||||
$this->assertEquals(2, $result->count());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user