From 83113f600480689d6de3d0842905bc888e36aa4a Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 14 Jan 2024 10:53:19 +0100 Subject: [PATCH 1/3] Improve TextBlock code & test --- src/Typography/TextBlock.php | 6 ++++++ tests/Typography/TextBlockTest.php | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Typography/TextBlock.php b/src/Typography/TextBlock.php index f83a7dc4..2eea0f13 100644 --- a/src/Typography/TextBlock.php +++ b/src/Typography/TextBlock.php @@ -23,6 +23,12 @@ public function lines(): array return $this->items; } + /** + * Get line by given key + * + * @param mixed $key + * @return null|Line + */ public function line($key): ?Line { if (!array_key_exists($key, $this->lines())) { diff --git a/tests/Typography/TextBlockTest.php b/tests/Typography/TextBlockTest.php index 60f7cf35..4f8cad43 100644 --- a/tests/Typography/TextBlockTest.php +++ b/tests/Typography/TextBlockTest.php @@ -35,6 +35,7 @@ public function testGetLine(): void $this->assertEquals('foo', $block->line(0)); $this->assertEquals('FooBar', $block->line(1)); $this->assertEquals('bar', $block->line(2)); + $this->assertNull($block->line(20)); } public function testLongestLine(): void From 92aa8b4b1eed138bca05e896f148cb1dd65a9f04 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 14 Jan 2024 10:55:52 +0100 Subject: [PATCH 2/3] Improve Origin code & tests --- tests/OriginTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/OriginTest.php b/tests/OriginTest.php index 9d9b2cdc..c3374ab9 100644 --- a/tests/OriginTest.php +++ b/tests/OriginTest.php @@ -13,6 +13,13 @@ public function testMediaType(): void $origin = new Origin('image/gif'); $this->assertEquals('image/gif', $origin->mediaType()); + $this->assertEquals('image/gif', $origin->mimetype()); + } + + public function testFilePath(): void + { + $origin = new Origin('image/jpeg', __DIR__ . '/tests/images/example.jpg'); + $this->assertEquals(__DIR__ . '/tests/images/example.jpg', $origin->filePath()); } public function testFileExtension(): void From 68a84685141112b9eaa6422de135d89117e97651 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 14 Jan 2024 11:00:28 +0100 Subject: [PATCH 3/3] Fix docblock --- tests/Colors/Hsl/ChannelTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Colors/Hsl/ChannelTest.php b/tests/Colors/Hsl/ChannelTest.php index 2c7f9c27..0b540efb 100644 --- a/tests/Colors/Hsl/ChannelTest.php +++ b/tests/Colors/Hsl/ChannelTest.php @@ -11,7 +11,7 @@ /** * @covers \Intervention\Image\Colors\Hsl\Channels\Hue * @covers \Intervention\Image\Colors\Hsl\Channels\Saturation - * @covers \Intervention\Image\Colors\Hsl\Channels\Value + * @covers \Intervention\Image\Colors\Hsl\Channels\Luminance */ class ChannelTest extends TestCase {