Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented May 23, 2025

Summary by CodeRabbit

  • Tests
    • Updated tests to expect more specific exception types for invalid float array items.
    • Added new tests to improve coverage of error handling and input validation for point array transformations.
    • Introduced additional tests to verify argument count validation in variadic functions, ensuring proper exception handling for invalid argument counts.
    • Refactored and expanded tests for network type arrays using data providers to enhance coverage of valid and invalid value transformations.
    • Added tests for coordinate precision validation in point value objects.
    • Extended test coverage for array transformations including handling of GD image resources and edge cases in Postgres array parsing.

@coveralls
Copy link

coveralls commented May 23, 2025

Coverage Status

coverage: 94.346% (+0.7%) from 93.695%
when pulling d1a5877 on tests
into 8679690 on main.

@coderabbitai
Copy link

coderabbitai bot commented May 23, 2025

## Walkthrough

This update enhances the test coverage for array and variadic function handling in the Doctrine DBAL and ORM layers. It introduces new tests for edge cases and error handling, adjusts exception expectations to use more specific custom exceptions, and adds data providers for invalid input scenarios. It also refactors some tests to use data providers for parameterized testing and improves regex consistency in coordinate validation.

## Changes

| File(s)                                                                                     | Change Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php                    | Updated a test to expect the custom `InvalidFloatArrayItemForPHPException` instead of Doctrine's `ConversionException`. Adjusted imports accordingly.                                                                                                                                                                                                                                                                                                                                                                                           |
| tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php                            | Added three new test methods and a data provider to increase coverage of `PointArray` transformation methods, focusing on handling of `null` and invalid input values, and appropriate exception throwing.                                                                                                                                                                                                                                                                                               |
| tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php | Added two tests for argument count validation in variadic functions, using reflection to invoke protected methods and verifying that custom exceptions are thrown for too few or too many arguments.                                                                                                                                                                                                                                                                                                      |
| tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php                  | Refactored tests to use PHPUnit data providers for parameterized testing of valid and invalid value transformations. Consolidated multiple tests into parameterized tests for converting to PHP values and for exception throwing on invalid inputs. Renamed some test methods for clarity.                                                                                                                                                                                                     |
| src/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Point.php                               | Extracted coordinate regex pattern into a reusable constant `COORDINATE_PATTERN` and updated `POINT_REGEX` accordingly. Updated coordinate validation to use the new pattern constant.                                                                                                                                                                                                                                                                                                          |
| tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php                                | Added tests to verify that coordinates with exactly six decimal places are accepted and that coordinates with more than six decimal places throw an exception.                                                                                                                                                                                                                                                                                                                               |
| tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php                 | Extended data provider with cases for arrays of nulls, booleans, and empty strings. Added a test verifying transformation of arrays containing GD image resources, skipping if GD extension is unavailable.                                                                                                                                                                                                                                                                                      |
| tests/Unit/MartinGeorgiev/Utils/PostgresArrayToPHPArrayTransformerTest.php                 | Added new test cases to the data provider to cover edge cases in Postgres array string inputs, including whitespace-only input, trailing commas, and arrays with special characters or empty strings.                                                                                                                                                                                                                                                                                            |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant TestCase
    participant PointArray
    participant Exception

    TestCase->>PointArray: transformArrayItemForPHP(null)
    PointArray-->>TestCase: return null

    TestCase->>PointArray: transformArrayItemForPHP(invalid)
    PointArray-->>Exception: throw InvalidPointArrayItemForPHPException

    TestCase->>PointArray: transformPostgresArrayToPHPArray(invalid)
    PointArray-->>TestCase: return []
sequenceDiagram
    participant TestCase
    participant BaseVariadicFunction
    participant Exception

    TestCase->>BaseVariadicFunction: validateArguments(tooFewArgs)
    BaseVariadicFunction-->>Exception: throw InvalidArgumentForVariadicFunctionException

    TestCase->>BaseVariadicFunction: validateArguments(tooManyArgs)
    BaseVariadicFunction-->>Exception: throw InvalidArgumentForVariadicFunctionException
Loading

Possibly related PRs

Poem

In the warren of code, new tests now appear,
Catching exceptions both far and near.
Arrays and points, with types held tight,
Variadic arguments checked for right.
The bugs must hop, the code stands tall—
With every test, we strengthen all!
🐇✨


<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBHbGlcABpIcVwvOkgAIgZYfH8ueGZefCkIkIUpKlIULGwMdSzEXERQ2MgAdzRkBwFmdRp6OQjYEkhsREpIZmdxDGISJKJ4Egl0ZFtIDEcBXoBmAA4AFg0YDr7tLEERMUlO/AAzds6Z1AJIMlhMBk7cLZoynOV86vUELEfOopLn8r8U4/HgUfD7TSbToJTCkZDaZgRfAFBj+OoPLYZZQ+BRKV55EjhMgOCjwDBEPpJaEsXgkDoYRCHUqDCmYejcfA0DDiNA+eSpdISMkUph4/xeeAqeAS3CyDZwc52VBoCTaLwqaKQY5JPwTcbVdC4M6QACqNgAMlxYLhcNxEBwAPQOsaPbACDRMZgO/oUQbDUbjCQOjllIj+RABLxgbUUMC0fBiUnkYPeLwOlbrcyWADCLDY3Pqjh9rgMCoUrHYyHw3wQyE8OP8QWyvFSzml8m1DG6/Br1NyaHybFwpIY8OQ/g5vpibVz/Z8FXQuL7bweVAYAGthUj8F55VsmP38mVqN2BGhaPkybR4AxqNJ2tRjV2KP5uZABNhpfRbvD8QOjqcACciwaMBACk4TVAgCQoPCWBkqiJDokCkAAAwaAATGBWpgoiIK0kK+DdgeK4ocBGgAGyAQArGBe6oAKYJSPmRrKjapIfi0SJPrc5L3mSw6KNg9z0GST55iU8BKNy8DHOMrTyD+sCQAAjBhaCLMcADsDCLFRqECKsywCEoKkqSQFFa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EQF9WUhhEIcoGr8J9N844b546b8FSIgq8gCCAWhma7802oMXCj7766pk/kHH/jh02QF99/j3kJY4U6XqIkyw28xD7k5m0t4V9czHmsVIqJTlSEU1SKG6HbN8B1FcavUoAC06CMrn7OowErWmk+CIkOJ2Rbgs2ZQcqtkB27LIdQo3MEL4CqRfx7mvSa7plhGSvMq293U4J80KzPd62r3crFAC2R4oz8mvO2gPQOYfMgamA0GiVhwH4tzuXCMsOYiHhNMAabvAlix1Wrohf+djXZjwhd7UZl6NdMglZwvLHpzeU0aUktHdRR9wMePWFGzytyks/U5PRGAYAZgrI0YOAdmNzy5j4xuQXAKgPzD57CxFAVMNQOLDphSwVByMQaOoHrjcp5cQoNlHQDirCo7Eyg1QSQGWCAQBAywfKKsAYDVRlgdAVCBhGohoBVgxwCiBRFWBaRjgwQrSCEIogqRAI5kHSMZEWCSxDAqgiiCQGogMBUIDAaiBRGOCARjgKkYIQIGogkBzIywTSMcGoguRFgKgVCLQGogCAQhtACiDlAEAZDLBEAQVCpDQCtQtIMQ1YKMNWBoA0AywNYMBFQiJDUIKwUqNRGogJCKIywFSC5EAi0BuhbgqwalBsFSQC4a8fUE4J2L6AgAA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=martin-georgiev/postgresql-for-doctrine&utm_content=384):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php (1)

44-75: Excellent test coverage for minimum argument validation with a minor comment issue.

The test correctly validates that the function throws an exception when too few arguments are provided. The anonymous class setup and reflection usage are appropriate for testing protected methods.

However, the comment on line 74 is misleading - it states "No arguments" but actually passes one argument ($node).

Update the comment to accurately reflect the test scenario:

-        $reflectionMethod->invoke($function, $node); // No arguments
+        $reflectionMethod->invoke($function, $node); // 1 argument when minimum is 2
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8679690 and e89b8c4.

📒 Files selected for processing (3)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php (1 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php (3)
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#318
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/XmlAggTest.php:1-9
Timestamp: 2025-03-29T03:31:17.114Z
Learning: Tests in the `Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), rather than PHPUnit's TestCase, and therefore don't need an explicit import.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#383
File: tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RadiansTest.php:1-9
Timestamp: 2025-05-23T11:11:57.926Z
Learning: Tests in the `Tests\Unit\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\Unit\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), rather than PHPUnit's TestCase directly, and therefore don't need an explicit import.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#318
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/XmlAggTest.php:1-9
Timestamp: 2025-03-29T03:31:17.114Z
Learning: Tests in the `Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), not PHPUnit's TestCase, and therefore don't need an explicit import statement.
🧬 Code Graph Analysis (1)
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidFloatArrayItemForPHPException.php (1)
  • InvalidFloatArrayItemForPHPException (14-35)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PostgreSQL 16 + PHP 8.3
  • GitHub Check: PostgreSQL 17 + PHP 8.3
  • GitHub Check: PostgreSQL 17 + PHP 8.2
  • GitHub Check: PostgreSQL 17 + PHP 8.4
  • GitHub Check: PostgreSQL 16 + PHP 8.4
  • GitHub Check: PostgreSQL 17 + PHP 8.1
  • GitHub Check: PostgreSQL 16 + PHP 8.2
  • GitHub Check: PostgreSQL 16 + PHP 8.1
  • GitHub Check: sloth
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer 3.0
🔇 Additional comments (7)
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)

8-8: Excellent improvement in exception specificity!

Replacing the generic ConversionException with the more specific InvalidFloatArrayItemForPHPException provides better error context and aligns with domain-driven exception handling practices. This change enhances test precision and makes error scenarios more explicit.

Also applies to: 67-67

tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php (2)

10-10: Good addition of necessary imports for new test functionality.

The imports for Node and InvalidArgumentForVariadicFunctionException are correctly added to support the new argument validation tests.

Also applies to: 13-13


77-108: Well-implemented test for maximum argument validation.

This test effectively verifies that the function throws an exception when too many arguments are provided. The anonymous class configuration and reflection approach are consistent with the previous test and appropriate for testing protected functionality.

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php (4)

195-199: Good edge case coverage for null input handling.

This test ensures that the transformArrayItemForPHP method correctly handles null input, which is an important edge case for robust type transformation.


201-207: Excellent exception testing with comprehensive data provider coverage.

This test effectively validates that invalid input types properly trigger the expected exception, using the data provider to ensure multiple invalid scenarios are covered.


209-217: Well-justified use of reflection for private method testing.

Testing the private transformPostgresArrayToPHPArray method provides valuable coverage of fallback behavior for invalid inputs. The reflection approach is appropriate here to ensure comprehensive error handling validation.


219-226: Comprehensive data provider for invalid input scenarios.

The data provider covers a good range of invalid input types (integer, non-point string, malformed array) that effectively test the error handling paths in the transformation methods.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 23, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes May 23, 2025
@martin-georgiev martin-georgiev enabled auto-merge (squash) May 23, 2025 14:15
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php (1)

134-139: Consider using a custom exception and improve test coverage.

While the test logic is correct, there are a few improvements to consider:

  1. Exception consistency: The test uses the generic \InvalidArgumentException, but the existing codebase uses custom exceptions like InvalidPointForPHPException. Consider using a more specific custom exception if one exists for coordinate validation.

  2. Test comprehensiveness: The test only validates the X coordinate with excessive precision. Consider testing both coordinates or using a data provider for more comprehensive coverage.

Here's an improved version using a data provider for better coverage:

+    #[DataProvider('provideCoordinatesWithExcessivePrecision')]
+    #[Test]
+    public function throws_for_coordinate_with_more_than_6_decimal_places(float $x, float $y): void
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        new PointValueObject($x, $y);
+    }
+
+    /**
+     * @return array<string, array{float, float}>
+     */
+    public static function provideCoordinatesWithExcessivePrecision(): array
+    {
+        return [
+            'x coordinate with 7 decimal places' => [1.1234567, 2.0],
+            'y coordinate with 7 decimal places' => [1.0, 2.1234567],
+            'both coordinates with excessive precision' => [1.1234567, 2.9876543],
+        ];
+    }
-    #[Test]
-    public function throws_for_coordinate_with_more_than_6_decimal_places(): void
-    {
-        $this->expectException(\InvalidArgumentException::class);
-        new PointValueObject(1.1234567, 2.0);
-    }
tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (1)

107-118: Fix typo in test case description.

The new test cases provide good coverage for homogeneous arrays. However, there's a typo in the description.

-            'with empty empty strings' => [
+            'with only empty strings' => [
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e5c0c5 and d1a5877.

📒 Files selected for processing (5)
  • src/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Point.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php (1 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Utils/PostgresArrayToPHPArrayTransformerTest.php (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Point.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: sloth
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 1.2
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer latest
🔇 Additional comments (3)
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php (1)

126-132: LGTM! Good precision validation test.

This test correctly verifies that coordinates with exactly 6 decimal places are accepted and properly stored in the PointValueObject.

tests/Unit/MartinGeorgiev/Utils/PostgresArrayToPHPArrayTransformerTest.php (1)

125-144:

✅ Verification successful

Good edge case coverage with one questionable test case.

The new test cases enhance coverage for edge scenarios in PostgreSQL array parsing. However, the 'with trailing comma' test case needs verification.

The test case 'with trailing comma' uses input '{a,}}' which appears malformed with an extra closing brace. Please verify this is valid PostgreSQL array syntax and the expected behavior.


🏁 Script executed:

#!/bin/bash
# Description: Verify PostgreSQL array syntax for trailing comma with extra brace
# Expected: Confirm if '{a,}}' is valid PostgreSQL array syntax

echo "Testing PostgreSQL array syntax..."
echo "Input: '{a,}}'"
echo "Expected output according to test: ['a']"
echo ""
echo "Please verify this syntax against PostgreSQL documentation or test with actual PostgreSQL instance."

Length of output: 440


🏁 Script executed:

#!/bin/bash
# Locate and inspect the PostgresArrayToPHPArrayTransformer implementation
rg "class PostgresArrayToPHPArrayTransformer" -A 200

Length of output: 41413


Approve edge case coverage

All five new tests accurately capture edge scenarios, and the transformer handles the trailing-comma case ('{a,}}' → ['a']) by design. No further changes needed.

tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (1)

253-264: Excellent resource handling test implementation.

The GD resource test is well-implemented with proper conditional skipping, resource creation, transformation testing, and cleanup. This adds valuable coverage for resource type handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants