diff --git a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php index 1b669bcb9..9dae9f935 100644 --- a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php +++ b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php @@ -17,11 +17,11 @@ public function __construct( throw new InvalidArgumentException('Sheet name can\'t be empty'); } - if (!\preg_match('/^[A-Z]+$/u', $startColumn)) { + if (!\preg_match('/^[A-Z]+$/', $startColumn)) { throw new InvalidArgumentException(\sprintf('The column `%s` needs to contain only letters.', $startColumn)); } - if (!\preg_match('/^[A-Z]+$/u', $endColumn)) { + if (!\preg_match('/^[A-Z]+$/', $endColumn)) { throw new InvalidArgumentException(\sprintf('The column `%s` needs to contain only letters.', $endColumn)); } diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php index ba96f7d6f..3cf38fc8b 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Adapter\GoogleSheet\Tests\Unit; use Flow\ETL\Adapter\GoogleSheet\Columns; +use Flow\ETL\Exception\InvalidArgumentException; use PHPUnit\Framework\TestCase; final class ColumnsTest extends TestCase @@ -23,6 +24,10 @@ public static function invalid_cases() : \Generator 'Sheet', 'AB C', 'CBA', 'The column `AB C` needs to contain only letters.', ]; + yield 'start column contains unicode' => [ + 'Sheet', 'ABĆ', 'CBA', + 'The column `ABĆ` needs to contain only letters.', + ]; yield 'end column contains number' => [ 'Sheet', 'ABC', 'CBA1', 'The column `CBA1` needs to contain only letters.', @@ -31,6 +36,10 @@ public static function invalid_cases() : \Generator 'Sheet', 'ABC', 'CB A', 'The column `CB A` needs to contain only letters.', ]; + yield 'end column contains unicode' => [ + 'Sheet', 'ABC', 'ĆB', + 'The column `ĆB` needs to contain only letters.', + ]; yield 'columns in valid orders' => [ 'Sheet', 'BA', 'AB', 'The column that starts the range `BA` must not be after the end column `AB`', @@ -42,7 +51,9 @@ public static function invalid_cases() : \Generator */ public function test_assertions(string $sheetName, string $startColumn, string $endColumn, string $expectedExceptionMessage) : void { + $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($expectedExceptionMessage); + new Columns($sheetName, $startColumn, $endColumn); } }