From da712b0e77d459257c3c3e2d0c369e474628e388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P?= Date: Wed, 25 Dec 2024 13:02:28 +0100 Subject: [PATCH] Test FitsHeader#keyword method --- composer.json | 3 ++- tests/FitsHeaderTest.php | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c9ed08c..19b49ae 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "phpunit/phpunit": "^11.3" }, "scripts": { - "run-pstan": "vendor/bin/phpstan analyze src/ --level 6" + "run-pstan": "vendor/bin/phpstan analyze src/ --level 6", + "run-tests": "vendor/bin/phpunit tests/ --display-warnings" }, "license": "MIT", "autoload": { diff --git a/tests/FitsHeaderTest.php b/tests/FitsHeaderTest.php index 2c8c961..5eed9b2 100644 --- a/tests/FitsHeaderTest.php +++ b/tests/FitsHeaderTest.php @@ -30,5 +30,30 @@ final class FitsHeaderTest extends TestCase '86' ); } + + public function testKeyword(): void + { + $keyword = $this->header->keyword('NAXIS1'); + + // Probably useless... (covered by PHPStan) + $this->assertInstanceOf(Dumbastro\FitsPhp\Keyword::class, $keyword); + + $this->assertEquals($keyword->value, 2448); + + $keyword = $this->header->keyword('EQUINOX'); + + $this->assertEquals(trim($keyword->value), '2000.'); + } + + /** + * @todo This fails for COMMENT keywords + public function testToString(): void + { + $headerBlock = $this->fits->headerBlock; + $headerString = $this->header->toString(); + + $this->assertEquals($headerBlock, $headerString); + } + */ }