From 461baaff6576b3fa6a18061ba53da88956a98238 Mon Sep 17 00:00:00 2001 From: zhukoff74 Date: Tue, 2 Dec 2025 00:06:43 +0300 Subject: [PATCH] Two tests have been rewritten to use modern PHPUnit style. --- .../Cell/CoordinateTest.php | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php b/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php index 095662d86..4a7dd70f4 100644 --- a/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php +++ b/tests/PhpSpreadsheetTests/Cell/CoordinateTest.php @@ -29,32 +29,18 @@ class CoordinateTest extends TestCase public function testColumnIndexFromStringTooLong(): void { - $cellAddress = 'ABCD'; + $this->expectException(Exception::class); + $this->expectExceptionMessage('Column string index can not be longer than 3 characters'); - try { - Coordinate::columnIndexFromString($cellAddress); - } catch (\Exception $e) { - self::assertInstanceOf(Exception::class, $e); - self::assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters'); - - return; - } - self::fail('An expected exception has not been raised.'); + Coordinate::columnIndexFromString('ABCD'); } public function testColumnIndexFromStringTooShort(): void { - $cellAddress = ''; + $this->expectException(Exception::class); + $this->expectExceptionMessage('Column string index can not be empty'); - try { - Coordinate::columnIndexFromString($cellAddress); - } catch (\Exception $e) { - self::assertInstanceOf(Exception::class, $e); - self::assertEquals($e->getMessage(), 'Column string index can not be empty'); - - return; - } - self::fail('An expected exception has not been raised.'); + Coordinate::columnIndexFromString(''); } #[DataProvider('providerColumnIndex')]