mirror of
https://github.com/Intervention/image.git
synced 2025-08-29 16:50:07 +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:
46
tests/Unit/Typography/TextBlockTest.php
Normal file
46
tests/Unit/Typography/TextBlockTest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Tests\Unit\Typography;
|
||||
|
||||
use Intervention\Image\Tests\BaseTestCase;
|
||||
use Intervention\Image\Typography\TextBlock;
|
||||
|
||||
final class TextBlockTest extends BaseTestCase
|
||||
{
|
||||
protected TextBlock $block;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->block = new TextBlock(<<<EOF
|
||||
foo
|
||||
FooBar
|
||||
bar
|
||||
EOF);
|
||||
}
|
||||
|
||||
public function testCount(): void
|
||||
{
|
||||
$this->assertEquals(3, $this->block->count());
|
||||
}
|
||||
|
||||
public function testLines(): void
|
||||
{
|
||||
$this->assertCount(3, $this->block->lines());
|
||||
}
|
||||
|
||||
public function testGetLine(): void
|
||||
{
|
||||
$this->assertEquals('foo', $this->block->line(0));
|
||||
$this->assertEquals('FooBar', $this->block->line(1));
|
||||
$this->assertEquals('bar', $this->block->line(2));
|
||||
$this->assertNull($this->block->line(20));
|
||||
}
|
||||
|
||||
public function testLongestLine(): void
|
||||
{
|
||||
$result = $this->block->longestLine();
|
||||
$this->assertEquals('FooBar', (string) $result);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user