Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Jul 31, 2025

Summary by CodeRabbit

  • Tests
    • Added a new unit test verifying Doctrine ORM version detection consistency.
    • Updated multiple test methods to use attribute-based annotations for clearer test identification and organization.
    • Renamed test methods and data providers for consistency and clarity without altering test logic.
    • Improved naming conventions in test data providers and variables for better readability.
    • Enhanced test coverage by parameterizing invalid input tests with data providers.
    • Refined PHPDoc type annotations for better clarity and type specificity across multiple test classes.
    • Expanded JSONB type tests to cover error handling for non-encodable values, circular references, and invalid JSON strings.

@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2025

Walkthrough

A new PHPUnit test class, DoctrineOrmTest, was introduced under the unit tests for MartinGeorgiev utilities. This class includes a test method that checks the consistency between the existence of the Doctrine\ORM\Query\TokenType class and the result of the DoctrineOrm::isPre219() method, ensuring proper version detection logic.

Additionally, multiple test classes in the tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ directory have been updated by renaming test methods to remove the test_ prefix and adding the #[Test] attribute for test identification. The test logic and expectations remain unchanged.

Other test files in tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ were updated for method renaming consistency, variable name normalization, PHPDoc formatting improvements, introduction of parameterized testing with data providers, and expanded test coverage for invalid inputs without changing test logic.

The JsonbTest class was extended with new tests to verify exception handling for non-encodable values, circular references, and invalid JSON strings.

Changes

Cohort / File(s) Change Summary
New Unit Test for DoctrineOrm Version Logic
tests/Unit/MartinGeorgiev/Utils/DoctrineOrmTest.php
Added a PHPUnit test class with a method to verify consistency between TokenType class existence and the isPre219() method outcome.
Test Attribute Migration and Method Renaming in ORM Query AST Functions
tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php, ArrayToJsonTest.php, DateAddTest.php, DateSubtractTest.php, JsonbInsertTest.php, JsonbPathExistsTest.php, JsonbPathMatchTest.php, JsonbPathQueryArrayTest.php, JsonbPathQueryFirstTest.php, JsonbPathQueryTest.php, JsonbSetTest.php, RegexpCountTest.php, RegexpInstrTest.php, RegexpLikeTest.php, RegexpMatchTest.php, RegexpReplaceTest.php, RegexpSubstrTest.php, RowToJsonTest.php
Renamed test methods to remove test_ prefix and added #[Test] attribute annotations. Test logic, exception expectations, and queries remain unchanged.
Data Provider Renaming and Expanded Invalid Input Coverage in DBAL Types Tests
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php, CidrTest.php, InetTest.php, InetArrayTest.php, MacaddrTest.php, MacaddrArrayTest.php, PointTest.php, PointArrayTest.php
Renamed data provider methods and corresponding test methods for clarity and consistency. Expanded invalid input test cases with additional invalid types and formats. No logic changes.
Variable and Parameter Renaming for Normalization Consistency
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php
Renamed variables and array keys from "Normalisation" to "Normalization" throughout test methods and data providers; no logic changes.
Method Renaming for Consistency in DBAL Types Tests
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php, BaseTypeTest.php, BaseArrayTest.php, Int4RangeTest.php, TsRangeTest.php, TstzRangeTest.php
Renamed test methods for naming consistency using "can_" prefix or clearer naming without changing test logic or assertions.
Refactoring to Parameterized Tests with Data Providers
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php
Converted invalid type tests to use data providers for multiple invalid inputs, renaming methods accordingly and improving test coverage.
PHPDoc Return Type Annotation Refinements
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php, DoublePrecisionArrayTest.php, InetArrayTest.php, IntegerArrayTest.php, JsonbArrayTest.php, MacaddrArrayTest.php, RealArrayTest.php, SmallIntArrayTest.php
Updated PHPDoc return type annotations from generic arrays to more precise list or expanded multi-line array shape formats for clarity and static analysis.
PHPDoc Cleanup in BaseTimestampRangeTestCase
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/BaseTimestampRangeTestCase.php
Removed extraneous PHPDoc block delimiter to unify class-level comment block; no functional changes.
Extended Exception Handling Tests in JsonbTest
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
Added tests for exceptions on non-encodable values, circular references, and invalid JSON strings with a new data provider; improved existing valid transformation data provider.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

enhancement, dx

Poem

🐇 In tests we hop and leap with glee,
Methods renamed for clarity.
Attributes added, tests aligned,
Bugs and errors left behind.
New checks ensure the code is tight,
Hopping forward, day and night!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ed9319c and 9c7de64.

📒 Files selected for processing (11)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php (1 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (3 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (3 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (3 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php (3 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php (9 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (3 hunks)
✅ Files skipped from review due to trivial changes (3)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php
🚧 Files skipped from review as they are similar to previous changes (7)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#0
File: :0-0
Timestamp: 2025-04-17T12:29:38.149Z
Learning: All new features in this repository must include proper test coverage before approval.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#357
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php:28-62
Timestamp: 2025-04-22T00:03:37.733Z
Learning: This project focuses on providing Doctrine ORM interfaces to PostgreSQL functions. Tests should validate correct DQL-to-SQL translation rather than PostgreSQL functionality itself. Test cases should focus on parameter passing and SQL generation, not on testing specific PostgreSQL regex pattern behaviors.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#352
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php:1-67
Timestamp: 2025-04-20T11:24:18.300Z
Learning: This PostgreSQL-for-Doctrine project is a translation layer only, focusing on correctly converting Doctrine DQL to PostgreSQL SQL syntax. It ensures arguments are passed in the expected format but does not test or handle PostgreSQL's actual function behavior or data handling. Test cases should focus on DQL-to-SQL translation and argument validation, not on PostgreSQL-specific behaviors.
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.951Z
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`), rather than PHPUnit's TestCase, 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.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#340
File: tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php:145-145
Timestamp: 2025-04-11T11:23:44.192Z
Learning: In the PostgreSQL for Doctrine test cases, methods that test database-to-PHP conversions should use `mixed` type for parameter and include non-string test cases in their data providers, following the pattern in classes like InetTest, CidrTest, and MacaddrTest.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#309
File: tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php:0-0
Timestamp: 2025-03-26T23:51:33.709Z
Learning: The requiresSQLCommentHint() method is intentionally kept in tests to support backwards compatibility with older Doctrine DBAL versions, even though it's deprecated in newer versions and triggers static analysis warnings. The method isn't used in production code.
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#263
File: src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/Numrange.php:19-21
Timestamp: 2025-03-11T12:32:10.726Z
Learning: In the postgresql-for-doctrine repository, PostgreSQL range functions have distinct implementations for different data types. The `Numrange` function works with numeric/decimal values and is tested using the `ContainsDecimals` fixture with properties typed as `float`. In contrast, the `Int4range` function works with 32-bit integers and is tested using the `ContainsIntegers` fixture with properties typed as `int`. While the PHP implementations share a similar structure (extending `BaseFunction`), they are semantically different as they handle different PostgreSQL data types.
📚 Learning: in the postgresql for doctrine test cases, methods that test database-to-php conversions should use ...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#340
File: tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php:145-145
Timestamp: 2025-04-11T11:23:44.192Z
Learning: In the PostgreSQL for Doctrine test cases, methods that test database-to-PHP conversions should use `mixed` type for parameter and include non-string test cases in their data providers, following the pattern in classes like InetTest, CidrTest, and MacaddrTest.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: the jsonvalue implementation in postgres-for-doctrine has documented limitations: it does not suppor...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#277
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonValueTest.php:19-35
Timestamp: 2025-03-13T15:00:16.619Z
Learning: The JsonValue implementation in postgres-for-doctrine has documented limitations: it does not support RETURNING type, DEFAULT clause, ON ERROR clause, ON EMPTY clause, and other advanced PostgreSQL JSON_VALUE features due to DQL limitations.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: tests in the `tests\unit\martingeorgiev\doctrine\orm\query\ast\functions` namespace extend a custom ...
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.951Z
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.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: the pr "preserve the type of floats and integers when transforming back and forth between postgresql...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#0
File: :0-0
Timestamp: 2025-03-26T02:46:12.804Z
Learning: The PR "preserve the type of floats and integers when transforming back and forth between PostgreSQL and PHP" improves type handling by ensuring that integers remain integers, floats remain floats, numeric strings stay as strings, and booleans are properly converted through the transformation process.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: tests in the `tests\martingeorgiev\doctrine\orm\query\ast\functions` namespace extend a custom `test...
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.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: tests in the `tests\martingeorgiev\doctrine\orm\query\ast\functions` namespace extend a custom `test...
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.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: this project focuses on providing doctrine orm interfaces to postgresql functions. tests should vali...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#357
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php:28-62
Timestamp: 2025-04-22T00:03:37.733Z
Learning: This project focuses on providing Doctrine ORM interfaces to PostgreSQL functions. Tests should validate correct DQL-to-SQL translation rather than PostgreSQL functionality itself. Test cases should focus on parameter passing and SQL generation, not on testing specific PostgreSQL regex pattern behaviors.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: in the postgresql-for-doctrine repository, postgresql range functions have distinct implementations ...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#263
File: src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/Numrange.php:19-21
Timestamp: 2025-03-11T12:32:10.726Z
Learning: In the postgresql-for-doctrine repository, PostgreSQL range functions have distinct implementations for different data types. The `Numrange` function works with numeric/decimal values and is tested using the `ContainsDecimals` fixture with properties typed as `float`. In contrast, the `Int4range` function works with 32-bit integers and is tested using the `ContainsIntegers` fixture with properties typed as `int`. While the PHP implementations share a similar structure (extending `BaseFunction`), they are semantically different as they handle different PostgreSQL data types.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: in sql generation code for the postgresql-for-doctrine library, it's better to fail explicitly with ...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#350
File: src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunction.php:78-88
Timestamp: 2025-04-18T10:33:52.412Z
Learning: In SQL generation code for the postgresql-for-doctrine library, it's better to fail explicitly with clear errors than to use fallback behavior that makes assumptions about node types, as this could lead to functional bugs or security issues.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: this postgresql-for-doctrine project is a translation layer only, focusing on correctly converting d...
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#352
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php:1-67
Timestamp: 2025-04-20T11:24:18.300Z
Learning: This PostgreSQL-for-Doctrine project is a translation layer only, focusing on correctly converting Doctrine DQL to PostgreSQL SQL syntax. It ensures arguments are passed in the expected format but does not test or handle PostgreSQL's actual function behavior or data handling. Test cases should focus on DQL-to-SQL translation and argument validation, not on PostgreSQL-specific behaviors.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
📚 Learning: when reviewing postgresql formatting function tests, the error handling behavior should match postgr...
Learnt from: karpilin
PR: martin-georgiev/postgresql-for-doctrine#386
File: tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTimestampTest.php:34-39
Timestamp: 2025-05-27T16:10:35.054Z
Learning: When reviewing PostgreSQL formatting function tests, the error handling behavior should match PostgreSQL's actual implementation rather than assuming consistency across all formatting functions, as different functions may handle invalid inputs differently.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 1.2
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + 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.1 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: sloth
🔇 Additional comments (5)
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php (5)

8-9: LGTM! Appropriate imports for error testing.

The new exception imports are correctly used in the error handling test methods.


53-99: Excellent improvement to test readability.

Converting the data provider to use descriptive keys significantly improves test failure debugging and documentation. The updated PHPDoc accurately reflects the new structure.


102-119: Well-structured error condition test.

The test properly handles resource creation, cleanup, and exception expectations. Good use of try-finally for resource management and appropriate PHPStan ignore comment for intentional invalid type testing.


121-153: Excellent comprehensive error handling test.

This test thoroughly validates circular reference handling with proper error handler management, warning verification, and resource cleanup. The sophisticated approach to testing both the exception and the underlying PHP warning demonstrates excellent testing practices.


155-179: Comprehensive invalid JSON testing with excellent coverage.

The test method and data provider cover a wide range of invalid JSON scenarios with descriptive test case names. This provides thorough coverage of the JSON parsing error path while maintaining good test organization and debugging capabilities.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch more-tests

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • 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 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 for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
@coveralls
Copy link

coveralls commented Jul 31, 2025

Coverage Status

coverage: 94.298% (+0.3%) from 93.987%
when pulling 9c7de64 on more-tests
into 8d18b35 on main.

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: 6

🔭 Outside diff range comments (1)
tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php (1)

47-75: Fix missing import for Test attribute.

The #[Test] attribute requires importing the PHPUnit\Framework\Attributes\Test class. Static analysis shows the attribute class cannot be found, which will cause test execution failures.

Add the missing import at the top of the file:

 use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateAdd;
 use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException;
 use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidTimezoneException;
+use PHPUnit\Framework\Attributes\Test;
♻️ Duplicate comments (4)
tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php (1)

45-46: Same missing Test attribute issue affects these methods.

This file has the same missing Test attribute import issue as identified in ArrayToJsonTest.php. The test logic changes are appropriate and maintain the same validation functionality for the row_to_json function.

Also applies to: 55-56

tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php (1)

46-47: Test attribute import missing (duplicate issue).

This file suffers from the same missing Test attribute import issue. The test methods correctly validate the array_position function's argument requirements, which aligns with the project's focus on DQL-to-SQL translation validation.

Also applies to: 56-57

tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php (1)

42-43: Test attribute import missing (duplicate issue).

This file has the same missing Test attribute import affecting all test files in this PR. The regexp_like function validation logic is appropriate and maintains focus on argument count validation for DQL-to-SQL translation.

Also applies to: 52-53

tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php (1)

48-49: Test attribute import missing (duplicate issue).

This file has the same missing Test attribute import issue affecting all files in this PR. The regexp_substr function validation correctly handles its wider argument range (2-6 arguments) and maintains appropriate focus on DQL-to-SQL translation validation.

Also applies to: 58-59

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 1, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 1, 2025
@martin-georgiev martin-georgiev changed the title chore: increase test coverage chore: improve test coverage and standardize style of unit tests in DBAL\Types namespace Aug 1, 2025
@martin-georgiev martin-georgiev merged commit 5dc36dc into main Aug 1, 2025
54 of 55 checks passed
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