Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Mar 20, 2025

Summary by CodeRabbit

  • Tests

    • Updated several test cases to include descriptive labels for database query verifications, enhancing clarity and maintainability.
    • Expanded test coverage for various JSON and text transformation scenarios, including checks for multiple keys in JSONB and various extraction scenarios.
    • Enhanced clarity of expected SQL and DQL statements by associating them with descriptive keys across multiple test files.
  • Chores

    • Adjusted configuration settings to improve overall test suite consistency.
  • Style

    • Refined formatting of test statements for improved readability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2025

Walkthrough

The pull request updates numerous test files to enhance clarity by replacing raw SQL and DQL string values with associative arrays that use descriptive keys. This refactoring spans tests for JSON, JSONB, and related functions, making it easier to understand what each query is intending to verify. Additionally, the ORM setup configuration in the main TestCase has been adjusted to enable attribute metadata.

Changes

File(s) Change Summary
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/{AllOnTheRightExistOnTheLeftTest, ArrayToJsonTest, JsonArrayLengthTest, JsonEachTest, JsonEachTextTest, JsonExistsTest, JsonGetFieldTest, JsonGetObjectAsTextTest, JsonQueryTest, JsonSerializeTest, JsonTypeofTest, JsonbArrayElementsTest, JsonbEachTest, JsonbExistsTest, JsonbPrettyTest, ToJsonTest, ToTsvectorTest}.php Updated expected SQL/DQL statements to use descriptive keys, adding context for checks such as multi-key existence, JSON extraction, and serialization.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/SimilarToTest.php Adjusted spacing in a DQL string for improved readability.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php Modified the second parameter in the ORMSetup call from false to true, enabling attribute metadata configuration.

Possibly related PRs

Poem

I'm a bouncy rabbit, coding through the night,
Hopping over SQL keys with pure delight.
JSON and JSONB now speak clear and true,
Each test a crunchy carrot—oh, what a view!
In this forest of code, I skip with glee,
Celebrating changes as happy as can be!
🐇🌟

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

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

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

22-23: Good addition of descriptive test case labels

Adding clear labels to the SQL test cases improves readability and makes the test purpose immediately clear. These descriptive keys for top-level and nested field extraction scenarios align well with PostgreSQL's JSON field extraction capabilities.

However, consider adding more comprehensive test cases based on PostgreSQL's documentation for the -> operator, such as:

  • Array element access (e.g., object1 -> 2)
  • Multiple nested levels (e.g., object1 -> 'deep' -> 'nested' -> 'value')
  • Numeric key access (e.g., object1 -> '0')
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1)

32-35: Consider adding one more test scenario for conditional path expressions

While the current tests cover the basic path expressions well, I noticed you could enhance test coverage by adding a test for conditional path expressions as shown in PostgreSQL documentation.

Looking at the retrieved learnings, I see that this library only supports the basic form of JSON_EXISTS with two parameters. However, it would be valuable to document in a comment that advanced features like path conditions are not supported.

 protected function getDqlStatements(): array
 {
     return [
         'checks if simple path exists' => \sprintf("SELECT JSON_EXISTS(e.object1, '$.name') FROM %s e", ContainsJsons::class),
         'checks if nested path exists' => \sprintf("SELECT JSON_EXISTS(e.object1, '$.address.city') FROM %s e", ContainsJsons::class),
         'checks if array element exists' => \sprintf("SELECT JSON_EXISTS(e.object1, '$.items[0]') FROM %s e", ContainsJsons::class),
         'checks if deeply nested array element exists' => \sprintf("SELECT JSON_EXISTS(e.object1, '$.users[0].addresses[0].street') FROM %s e", ContainsJsons::class),
+        // Note: Advanced PostgreSQL JSON_EXISTS features like conditional path expressions are not supported
     ];
 }
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1)

29-29: Consider adding nested object test case

The current test covers basic jsonb_each functionality on a top-level object, which is good. However, according to PostgreSQL documentation, jsonb_each can also be used with nested objects by first accessing them.

Consider adding an additional test case that demonstrates using jsonb_each on a nested object to provide more comprehensive coverage.

protected function getDqlStatements(): array
{
    return [
        'expands top-level jsonb object into key-value pairs' => \sprintf('SELECT JSONB_EACH(e.object1) FROM %s e', ContainsJsons::class),
+       'expands nested jsonb object into key-value pairs' => \sprintf("SELECT JSONB_EACH(JSONB_GET_FIELD(e.object1, 'metadata')) FROM %s e", ContainsJsons::class),
    ];
}

Note that this would also require a corresponding update to the getExpectedSqlStatements() method and may require you to ensure the JSONB_GET_FIELD function is also registered.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 92be1de and ecef5d1.

📒 Files selected for processing (19)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonSerializeTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonTypeofTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPrettyTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/SimilarToTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToJsonTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.php (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php`: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL que...

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL queries for the tested SQL functions and operators.

  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/SimilarToTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonTypeofTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPrettyTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToJsonTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonSerializeTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.php
🧠 Learnings (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1)
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#277
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php:10-0
Timestamp: 2025-03-19T13:11:34.140Z
Learning: The implementation of JSON_EXISTS in this library supports only the basic form with two parameters (target_json, path_text) and doesn't support additional features like strict mode (third boolean parameter), ON ERROR clause, or other advanced PostgreSQL JSON_EXISTS capabilities due to DQL limitations.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1)
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#277
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php:10-0
Timestamp: 2025-03-19T13:11:34.140Z
Learning: The implementation of JSON_EXISTS in this library supports only the basic form with two parameters (target_json, path_text) and doesn't support additional features like strict mode (third boolean parameter), ON ERROR clause, or other advanced PostgreSQL JSON_EXISTS capabilities due to DQL limitations.
🧬 Code Definitions (16)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (6)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1) (1)
  • getDqlStatements (32-43)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (5)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonTypeofTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (3)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (1) (1)
  • getDqlStatements (34-47)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonValueTest.php (1) (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1) (1)
  • getDqlStatements (32-43)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (4)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php (5)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonTypeofTest.php (6)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1) (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (1) (1)
  • getDqlStatements (34-47)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1) (1)
  • getDqlStatements (32-43)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php (5)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPrettyTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (3)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1) (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonValueTest.php (1) (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (4)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbArrayElementsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php (8)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1) (1)
  • getDqlStatements (32-43)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonSerializeTest.php (1) (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyOnTheRightExistsOnTheLeftTest.php (1) (1)
  • getDqlStatements (28-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DeleteAtPathTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TheRightExistsOnTheLeftTest.php (1) (1)
  • getDqlStatements (28-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ReturnsValueForJsonValueTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPrettyTest.php (7)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonTypeofTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1) (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (1) (1)
  • getDqlStatements (34-47)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1) (1)
  • getDqlStatements (32-43)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToJsonTest.php (6)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsqueryTest.php (1) (1)
  • getDqlStatements (29-36)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToJsonbTest.php (1) (1)
  • getDqlStatements (30-39)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/SimilarToTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1) (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (1) (1)
  • getDqlStatements (34-47)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonSerializeTest.php (8)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetObjectAsTextTest.php (1) (1)
  • getDqlStatements (32-43)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php (1) (1)
  • getDqlStatements (29-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonGetFieldTest.php (1) (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbEachTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonExistsTest.php (1) (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonQueryTest.php (1) (1)
  • getDqlStatements (34-47)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonValueTest.php (1) (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonScalarTest.php (1) (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.php (4)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsqueryTest.php (1) (1)
  • getDqlStatements (29-36)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToJsonTest.php (1) (1)
  • getDqlStatements (30-39)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1) (1)
  • getDqlStatements (92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UnaccentTest.php (1) (1)
  • getDqlStatements (28-34)
🪛 GitHub Check: PHP 8.3 + Doctrine ORM 3.0
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.2 + Doctrine ORM latest
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.4 + Doctrine ORM 3.0
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.4 + Doctrine ORM latest
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.3 + Doctrine ORM latest
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.2 + Doctrine ORM 2.14
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.1 + Doctrine ORM 2.14
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.4 + Doctrine ORM 2.14
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.2 + Doctrine ORM 3.0
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.1 + Doctrine ORM latest
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.1 + Doctrine ORM 3.0
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🪛 GitHub Check: PHP 8.3 + Doctrine ORM 2.14
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJsonTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

[failure] 29-29:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLengthTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php

[failure] 31-31:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeftTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonEachTextTest.php

[failure] 28-28:
Method Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachTextTest::getDqlStatements() should return array<int, string> but returns array<string, string>.

🔇 Additional comments (28)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1)

26-26: Configuration change improves testing capabilities.

Changing the second parameter of createAttributeMetadataConfiguration from false to true enables attribute metadata in the ORM setup, which is essential for supporting attribute-based annotations in entity classes. This aligns with the PR objective of improving test scenarios.

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

29-29: Code formatting improvement for better readability.

The addition of spacing between the comma and the string literal in the SIMILAR_TO function call improves code readability while maintaining the same functionality.

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

22-22:

✅ Verification successful

The test accurately verifies JSONB_EXISTS functionality.

The test correctly checks if a top-level key 'country' exists in a JSONB object, which matches PostgreSQL's jsonb_exists operator functionality. This aligns with PostgreSQL documentation.


🌐 Web query:

PostgreSQL jsonb_exists function syntax and examples

💡 Result:

The jsonb_exists function in PostgreSQL checks if a specified string exists as a top-level key in a JSONB object or as an element in a JSONB array. It is functionally equivalent to the ? operator[3][6][7].

Syntax

jsonb_exists(jsonb_data text_element)
  • jsonb_data: The JSONB column or value to check.
  • text_element: The string to search for as a key or element.

Examples

1. Check for a top-level key in a JSONB object:

SELECT jsonb_exists('{"name": "Alice", "age": 30}'::jsonb, 'name');  
-- Returns TRUE

This verifies that the key "name" exists in the JSON object[3][7].

2. Check for an element in a JSONB array:

SELECT jsonb_exists('["apple", "banana", "cherry"]'::jsonb, 'banana');  
-- Returns TRUE

This checks if "banana" is a top-level array element[2][6].

3. Use in a WHERE clause to filter rows:

SELECT * FROM products 
WHERE jsonb_exists(attributes, 'color');  
-- Returns rows where the JSONB column "attributes" contains the key "color"

This filters records where the attributes column includes the "color" key[3][6].

Key Notes:

  • The function does not search nested objects or arrays—only top-level elements[3][7].
  • For checking multiple keys, use jsonb_exists_any (?|) or jsonb_exists_all (?&) with arrays[2][7].
  • If using indexes, create a GIN index on the JSONB column to optimize these queries[3][8].

Comparison to ? Operator:

Both achieve the same result:

-- Using the operator
SELECT '{"a": 1}'::jsonb ? 'a';         -- TRUE
-- Using the function
SELECT jsonb_exists('{"a":1}'::jsonb, 'a'); -- TRUE

The choice between them depends on syntax preference or integration with ORM tools[4][6][7].

Citations:


Test Verification Confirmed – No Changes Required

The test in tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbExistsTest.php correctly verifies the JSONB_EXISTS functionality by checking for the existence of the top-level key 'country' in a JSONB object. This behavior aligns with PostgreSQL's documented usage of jsonb_exists, which confirms that the operator (or function) is intended to validate the presence of a key at the top level of a JSONB structure.

No modifications are necessary.

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

22-22:

✅ Verification successful

The test accurately verifies array_to_json functionality.

The test correctly verifies the PostgreSQL array_to_json function, which converts an array to a JSON string. According to PostgreSQL documentation, this function takes a single array parameter and returns a JSON string, which is correctly implemented in this test.


🌐 Web query:

PostgreSQL array_to_json function syntax and examples

💡 Result:

PostgreSQL's array_to_json() function converts SQL arrays into JSON arrays, facilitating seamless integration with web services and applications requiring JSON data. This function supports both simple and multidimensional arrays, offers optional formatting for readability, and handles NULL values by converting them to JSON null.

Syntax and Parameters

The function's syntax is:

array_to_json(array ARRAY, pretty BOOLEAN)
  • array: The SQL array to convert (e.g., INT[], TEXT[]).
  • pretty (optional): A boolean (true/false) to format the output with indentation and line breaks[1][5][7].

The return value is a JSON array.

Examples

Basic Conversion
Convert a simple integer array:

SELECT array_to_json('{100, 12, 53, -1, 24}'::INT[]) AS result;
-- Result: [100, 12, 53, -1, 24][1][7]

Multidimensional Arrays
Convert a 2D text array:

SELECT array_to_json('{{"John", "Joseph"}, {"Henry", "Anna"}}'::TEXT[]);
-- Result: [["John", "Joseph"], ["Henry", "Anna"]][1][10]

Pretty-Printing
Enable formatting with pretty := true:

SELECT array_to_json('{{1,5},{99,100}}'::INT[], true);
/*
Result:
[
    [1, 5],
    [99, 100]
][7][10]
*/

Handling NULL Values
NULL elements become JSON null:

SELECT array_to_json(ARRAY['A', NULL, 'B']);
-- Result: ["A", null, "B"][7][9]

Key Use Cases

  • API Integration: Convert database-stored arrays (e.g., user preferences, tags) to JSON for APIs[7][8].
  • Aggregation: Combine with array_agg to transform query results into nested JSON structures:
    SELECT array_to_json(array_agg(row_to_json(cart_items))) 
    FROM cart_items 
    WHERE user_id = 123;
    -- Outputs a JSON array of cart items[7][9]  

Comparison to Related Functions

  • to_json(): Converts any SQL value (not just arrays) to JSON. For arrays, array_to_json is more direct[3][10].
  • json_build_array(): Manually constructs JSON arrays with explicit elements, offering finer control over structure[7][9].

For nested JSON generation, pair array_to_json with json_agg and json_build_object to group data by keys[4][7].

Citations:


Test Verified: PostgreSQL array_to_json Conversion is Correctly Implemented

The test in tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php accurately validates the use of PostgreSQL’s array_to_json function. The SQL snippet:

'converts simple array to json' => 'SELECT array_to_json(c0_.array1) AS sclr_0 FROM ContainsArrays c0_',

aligns with PostgreSQL documentation, which confirms that the function takes an array and returns its JSON representation. No modifications are required.

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

30-31: Good corresponding DQL test cases

The DQL statements match the expected SQL statements well, with both covering the extraction of top-level and nested fields. This maintains consistency between the test expectations and the actual implementation.

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

22-25: Excellent improvement with descriptive keys and more test scenarios

The addition of descriptive keys significantly enhances the readability of the test cases. The new test for deeply nested array elements (line 25) is particularly valuable as it covers a more complex use case that was missing before.

These test cases now better reflect the examples in PostgreSQL's documentation for json_exists(), covering simple paths, nested paths, array elements, and deeply nested structures.

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

22-22: Good addition of descriptive key

Adding a descriptive key to the SQL statement improves test readability by clearly stating what the function is testing.

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

22-22: Good addition of descriptive key

Adding a descriptive key to the SQL statement improves test clarity and readability. The 'expands top-level jsonb object into key-value pairs' description accurately reflects the purpose of the test.

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

22-28: Great improvements to test coverage for JSON path extraction scenarios!

The addition of multiple test cases with descriptive keys greatly enhances the documentation and coverage of the PostgreSQL #>> operator functionality. The test cases now comprehensively cover various JSON path extraction scenarios including:

  • Top-level object extraction
  • Nested object access
  • Array element access (first, specific index, last)
  • Complex nested paths
  • Deeply nested structures

This aligns well with PostgreSQL's JSON path access documentation and provides clearer examples for users of this library.


35-41: DQL statements properly aligned with SQL statements

The DQL statements match perfectly with their corresponding SQL statements, maintaining consistent descriptive keys between both methods. This makes it easier to understand the relationship between the DQL and the resulting SQL.

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

22-23: Enhanced test coverage with descriptive keys

The addition of descriptive keys improves the readability of test cases, and adding a test with a literal JSON value increases coverage of the json_array_length function's capabilities.

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

22-23: Improved readability with descriptive keys

Adding descriptive keys to the SQL statements enhances test readability and documentation.


30-31:

❓ Verification inconclusive

Check intent for the literal value test

The added test case with literal value '42' is testing json_typeof('42') which will return 'string' in PostgreSQL, not 'number'. If you intended to test with a numeric value, the parameter should be passed without quotes or using proper JSON syntax.

Verify this using:


🏁 Script executed:

#!/bin/bash
# Check what PostgreSQL json_typeof returns for different values
echo "Testing literal value with quotes (string):"
echo "SELECT json_typeof('42') as result;" | psql postgres -t

echo "Testing numeric value (number):"
echo "SELECT json_typeof(42) as result;" | psql postgres -t

echo "Testing JSON-encoded number:"
echo "SELECT json_typeof('42'::jsonb) as result;" | psql postgres -t

Length of output: 731


🌐 Web query:

PostgreSQL json_typeof function behavior with quoted vs unquoted values

💡 Result:

PostgreSQL's json_typeof and jsonb_typeof functions determine the data type of a JSON value based on its syntax, treating quoted values as strings and unquoted literals as their respective JSON types. Here's how it works:

  • Quoted values (e.g., '"123"', '"true"') are always classified as strings. This includes values that resemble numbers, booleans, or null when enclosed in quotes:

    SELECT jsonb_typeof('"123"');  -- Returns 'string' [1][5][8]
    SELECT jsonb_typeof('"null"'); -- Returns 'string' [1][5]
  • Unquoted values resolve to their native JSON types:

    • Numbers: 100, 12.5'number' [1][5][8]
    • Booleans: true, false'boolean' [1][8]
    • Null: null'null' [1][5][8]
    • Arrays/objects: [1, 2]'array'; {"key": "value"}'object' [1][8]

For example:

SELECT jsonb_typeof('123');       -- 'number'
SELECT jsonb_typeof('true');      -- 'boolean'
SELECT jsonb_typeof('null');      -- 'null'
SELECT jsonb_typeof('[1, 2]');    -- 'array' [1][8]

This behavior stems from JSON parsing rules: quotes explicitly denote strings, while unquoted literals are parsed as their native types. The functions inspect the JSON structure directly, not the underlying data content[1][5][7][8].

Citations:


Attention: Verify the Intended Behavior for Literal Value Testing

The test in
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonTypeofTest.php (lines 30–31)
uses

'determines type of literal value' => sprintf("SELECT JSON_TYPEOF('42') FROM %s e", ContainsJsons::class),

Based on PostgreSQL’s documented behavior, quoting a value (like '42') causes it to be interpreted as a JSON string, so json_typeof('42') will return "string", not "number". If the intent was to verify numeric behavior, the test should either pass an unquoted numeric literal (e.g., using 42 without quotes) or encode the number as valid JSON.

Please confirm whether the expected result is indeed a string, or if the test should be updated to check for a numeric type.

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

22-22: Improved readability with descriptive key

Adding the descriptive key 'expands json object into text key-value pairs' clearly documents what this test is verifying, making the test more maintainable and easier to understand.

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

22-22: Good addition of descriptive key for SQL statement.

The descriptive key 'expands jsonb array into separate rows' clearly explains the purpose of this test case, enhancing readability and making the test's intent immediately obvious. This aligns well with the PR objective of improving test clarity.


29-29: Good addition of descriptive key for DQL statement.

Adding 'expands jsonb array into separate rows' as a descriptive key for the DQL statement maintains consistency with the SQL test and clearly documents the function's purpose. This improves test readability.

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

22-31: Excellent expansion of test cases with descriptive keys.

The changes significantly improve the test suite by adding comprehensive test scenarios for PostgreSQL's json_query functionality. The descriptive keys provide clear documentation of what each test case is verifying:

  1. Basic scenarios: extracting array items, nested objects
  2. Path navigation: accessing specific elements in nested structures
  3. Advanced filtering: using conditions and range specifications
  4. Complex queries: combining multiple conditions

This aligns perfectly with the PR objective of improving test clarity and adding more SQL scenarios. The test cases now provide thorough coverage of PostgreSQL's json_query capabilities as described in the official documentation.


37-46: Excellent DQL statement expansions with matching descriptive keys.

The DQL statements now have clear, descriptive keys that mirror those in the SQL statements, creating a consistent and well-documented test suite. The additional test cases significantly enhance coverage of PostgreSQL's json_query functionality:

  1. Path navigation with $.items[*], $.address, etc.
  2. Array filtering with boolean conditions using syntax like ?(@.price > 10)
  3. Range selection with [0 to 2]
  4. Special selectors like [last]
  5. Complex filtering with multiple conditions

These changes make the tests more comprehensive and easier to understand, fulfilling the PR's objectives.

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

22-23: Good addition of descriptive keys for SQL statements.

The descriptive keys 'formats jsonb document with proper indentation' and 'formats literal jsonb value' clearly explain the purpose of each test case. This improves readability and makes the test's intent immediately obvious, aligning with the PR objective.


30-31: Good addition of descriptive keys for DQL statements.

Adding matching descriptive keys for the DQL statements creates consistency between SQL and DQL tests. The keys effectively document that the test verifies both formatting of document fields and literal values, making the test's purpose clearer.

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

22-26: Good addition of descriptive keys for SQL statements.

The changes enhance test readability by adding descriptive keys that clearly explain what each test case is verifying:

  • 'converts text to json'
  • 'converts uppercase text to json'
  • 'converts numeric expression to json'
  • 'converts boolean to json'
  • 'converts length of text to json'

These descriptions align with PostgreSQL's to_json function capabilities as described in the official documentation, demonstrating comprehensive test coverage of various data type conversions.


33-37: Good addition of descriptive keys for DQL statements.

The DQL statements now have matching descriptive keys that mirror those in the SQL statements, creating consistency throughout the test. The keys effectively document the various data type conversions being tested, making the test suite more maintainable and easier to understand.

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

24-25: Improved test clarity with descriptive keys for SQL statements

The addition of descriptive keys to the SQL statements enhances test readability by clearly indicating what each test case is verifying. The new test case for multiple keys is particularly valuable as it covers an important use case of the PostgreSQL ??& operator.

This aligns well with the PR objective of improving test clarity and documentation.


32-33:

❓ Verification inconclusive

Enhanced DQL statement organization with descriptive keys

Adding descriptive keys to DQL statements creates a clear mapping between the test's intent and the SQL being generated. The new multiple keys test case provides more comprehensive coverage of the PostgreSQL ??& operator functionality.

However, there's a type error highlighted by static analysis tools:

The static analysis shows that the getDqlStatements() method should return array<int, string> but now returns array<string, string>. This typing issue appears across multiple tests. Please verify if the parent TestCase class needs to be updated to accommodate associative arrays or if the method documentation needs adjustment.


🏁 Script executed:

#!/bin/bash
# Check the parent TestCase class declaration
grep -A 5 "function getDqlStatements" tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php

Length of output: 255


Action Required: Verify TestCase::getDqlStatements() Return Type

The new descriptive keys significantly improve the clarity of the DQL statements. However, since static analysis now expects the return type to be an indexed array (array<int, string>) while your implementation returns an associative array (array<string, string>), please verify one of the following approaches:

  • Update the parent TestCase PHPDoc and/or static analysis configuration to explicitly allow associative arrays (i.e. array<string, string>) if the descriptive keys are intentional.
  • Alternatively, consider reverting to a numeric index arrangement in your DQL mappings if the intent is to adhere strictly to the original return type.

Relevant file locations:

  • Test File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AllOnTheRightExistOnTheLeftTest.php (lines 32–33)
  • Parent Class: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (method getDqlStatements())

Please adjust accordingly based on your desired test organization and typing conventions.

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

22-24: Improved test clarity with descriptive keys for SQL statements

The addition of descriptive keys to the SQL statements enhances readability by providing context about what each test is verifying. This makes the test file more self-documenting and easier to maintain.

This approach is consistent with the PR objective of improving test clarity by adding descriptions to query variations.


31-33: Enhanced DQL statements with descriptive keys

Adding descriptive keys for each DQL statement creates a clear mapping between the test descriptions and corresponding SQL output, improving maintainability and comprehension.

The tests cover important use cases for PostgreSQL's JSON serialization:

  1. Basic field serialization
  2. Serialization with expression (UPPER)
  3. Serialization of JSON literals

This provides good coverage of the PostgreSQL json_serialize functionality.

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

23-25: Improved test clarity with descriptive keys for SQL statements

The addition of descriptive keys provides valuable context about what each test is verifying. This makes the test cases more self-documenting and aligns with PostgreSQL's to_tsvector function capabilities.

The test cases appropriately cover important scenarios for the to_tsvector function:

  1. Basic text conversion
  2. Conversion with lowercase transformation
  3. Conversion with specific dictionary (English)

This is aligned with the PR objective of adding descriptions to tested query variations.


32-34: Enhanced DQL statement organization with descriptive keys

Adding descriptive keys to DQL statements creates clear, maintainable test cases. The tests cover the fundamental use cases of PostgreSQL's to_tsvector function according to the documentation.

These improvements make it easier to understand the test's intent and maintain the tests over time. The coverage aligns well with real-world use cases of full-text search in PostgreSQL.

@coveralls
Copy link

coveralls commented Mar 20, 2025

Coverage Status

coverage: 94.944%. remained the same
when pulling 9f15459 on more-tests
into 2dd1f2f on main.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 20, 2025
@martin-georgiev martin-georgiev marked this pull request as ready for review March 24, 2025 22:42
@martin-georgiev martin-georgiev merged commit b13ddde into main Mar 24, 2025
42 of 47 checks passed
@martin-georgiev martin-georgiev deleted the more-tests branch March 24, 2025 22:43
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: 1

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

22-22: Improved test clarity with descriptive keys.

The addition of descriptive keys for the test cases improves the test documentation and makes the purpose of each test scenario clearer.

According to PostgreSQL documentation, the array_to_string function supports an optional third parameter null_string which is used to replace NULL values in the array. Consider adding additional test scenarios to cover this functionality:

    protected function getExpectedSqlStatements(): array
    {
        return [
            'converts array to string with delimiter' => "SELECT array_to_string(c0_.array1, ',') AS sclr_0 FROM ContainsArrays c0_",
+           'converts array to string with delimiter and null replacement' => "SELECT array_to_string(c0_.array1, ',', 'NULL') AS sclr_0 FROM ContainsArrays c0_",
        ];
    }

    protected function getDqlStatements(): array
    {
        return [
            'converts array to string with delimiter' => \sprintf("SELECT ARRAY_TO_STRING(e.array1, ',') FROM %s e", ContainsArrays::class),
+           'converts array to string with delimiter and null replacement' => \sprintf("SELECT ARRAY_TO_STRING(e.array1, ',', 'NULL') FROM %s e", ContainsArrays::class),
        ];
    }

This would make the tests more comprehensive by covering all parameters of the PostgreSQL array_to_string function.

Also applies to: 29-29

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

31-33: Improved test readability with consistent naming and named parameters.

These changes align perfectly with the PR objectives by adding descriptive case names and making the DQL statements more readable. The use of named parameters (:old_value, :new_value) in line 33 is particularly good for clarity versus generic placeholders.

Consider adding additional test cases to cover more PostgreSQL array_replace functionality:

  1. Testing with NULL values (as array elements or replacements)
  2. Using NULL as the third argument (which behaves like array_remove)
  3. Testing with multi-dimensional arrays to verify dimension preservation
protected function getDqlStatements(): array
{
    return [
        'replaces string element in array' => \sprintf("SELECT ARRAY_REPLACE(e.array1, 'old-value', 'new-value') FROM %s e", ContainsArrays::class),
        'replaces numeric element in array' => \sprintf('SELECT ARRAY_REPLACE(e.array1, 42, 43) FROM %s e', ContainsArrays::class),
        'replaces element using parameters' => \sprintf('SELECT ARRAY_REPLACE(e.array1, :old_value, :new_value) FROM %s e', ContainsArrays::class),
+       'handles null replacement value' => \sprintf('SELECT ARRAY_REPLACE(e.array1, 42, NULL) FROM %s e', ContainsArrays::class),
+       'removes elements with null as target' => \sprintf('SELECT ARRAY_REPLACE(e.array1, :value_to_remove, NULL) FROM %s e', ContainsArrays::class),
    ];
}
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)

22-22: Clear naming for array_dims test scenario

The descriptive key "gets dimensions of array field" effectively communicates the test's purpose, matching the PostgreSQL array_dims function's basic functionality.

Consider adding additional test scenarios for array_dims with edge cases like empty arrays and multi-dimensional arrays to provide more comprehensive coverage. For example:

protected function getExpectedSqlStatements(): array
{
    return [
        'gets dimensions of array field' => 'SELECT array_dims(c0_.array1) AS sclr_0 FROM ContainsArrays c0_',
+       'gets dimensions of multi-dimensional array' => 'SELECT array_dims(c0_.array_2d) AS sclr_0 FROM ContainsArrays c0_',
+       'gets dimensions of empty array' => 'SELECT array_dims(\'{}\') AS sclr_0 FROM ContainsArrays c0_',
    ];
}
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (1)

29-29: Consider adding tests for multi-dimensional arrays.

While the current test case covers the basic functionality of array_ndims, PostgreSQL's documentation indicates the function can handle multi-dimensional arrays. Consider adding additional test cases that verify this behavior for more comprehensive test coverage.

 protected function getDqlStatements(): array
 {
     return [
         'gets number of dimensions of array field' => \sprintf('SELECT ARRAY_NUMBER_OF_DIMENSIONS(e.array1) FROM %s e', ContainsArrays::class),
+        'gets number of dimensions of multi-dimensional array' => \sprintf('SELECT ARRAY_NUMBER_OF_DIMENSIONS(e.arrayMulti) FROM %s e', ContainsArrays::class),
     ];
 }
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/CastTest.php (1)

22-27: Improved SQL test coverage with PostgreSQL-specific data types

The updated test cases now include a more comprehensive set of PostgreSQL CAST operations including INTEGER, TEXT, JSON, JSONB, BOOLEAN, and DECIMAL with precision. This aligns well with the PR objective of improving test scenarios.

Consider adding more PostgreSQL-specific data types for even more comprehensive coverage:

 protected function getExpectedSqlStatements(): array
 {
     return [
         'cast as integer' => 'SELECT cast(c0_.text1 as INTEGER) AS sclr_0 FROM ContainsTexts c0_',
         'cast as text' => 'SELECT cast(c0_.text1 as TEXT) AS sclr_0 FROM ContainsTexts c0_',
         'cast as json' => 'SELECT cast(c0_.text1 as JSON) AS sclr_0 FROM ContainsTexts c0_',
         'cast as jsonb' => 'SELECT cast(c0_.text1 as JSONB) AS sclr_0 FROM ContainsTexts c0_',
         'cast as boolean' => 'SELECT cast(c0_.text1 as BOOLEAN) AS sclr_0 FROM ContainsTexts c0_',
         'cast with precision' => 'SELECT cast(c0_.text1 as DECIMAL(10, 2)) AS sclr_0 FROM ContainsTexts c0_',
+        'cast as date' => 'SELECT cast(c0_.text1 as DATE) AS sclr_0 FROM ContainsTexts c0_',
+        'cast as timestamp' => 'SELECT cast(c0_.text1 as TIMESTAMP) AS sclr_0 FROM ContainsTexts c0_',
     ];
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 470b491 and 9f15459.

📒 Files selected for processing (16)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyOnTheRightExistsOnTheLeftTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCatTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/CastTest.php (2 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php
🧰 Additional context used
📓 Path-based instructions (1)
`tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php`: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL que...

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL queries for the tested SQL functions and operators.

  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyOnTheRightExistsOnTheLeftTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCatTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/CastTest.php
🧬 Code Definitions (12)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (3)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php (10)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (10)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCatTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php (5)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php (9)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (9)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (9)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCatTest.php (5)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/CastTest.php (17)
fixtures/MartinGeorgiev/Doctrine/Entity/Entity.php (1)
  • Entity (10-16)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayLengthTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCatTest.php (1)
  • getDqlStatements (27-33)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayNumberOfDimensionsTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php (1)
  • getDqlStatements (26-31)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ContainsTest.php (1)
  • getDqlStatements (29-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/AnyOnTheRightExistsOnTheLeftTest.php (1)
  • getDqlStatements (30-37)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php (1)
  • getDqlStatements (28-35)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1)
  • getDqlStatements (92-92)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: sloth
🔇 Additional comments (20)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php (1)

22-24: Great improvement with descriptive test case names!

The changes to use descriptive keys for the SQL statements make the test cases much clearer, allowing readers to understand the purpose of each test without having to analyze the SQL statements themselves. The use of more meaningful values like 'old-value', 'new-value', 42, and 43 also helps clarify the intent.

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

22-25: Great improvements to test cases!

The additions provide excellent test coverage for PostgreSQL's @> (contains) array operator:

  • Testing array of integers
  • Testing array of strings
  • Testing for a single element
  • Testing with a parameterized value

These cases align well with PostgreSQL's documentation for the array contains operator and improve test clarity with descriptive keys.


32-35: DQL statements match the SQL expectations well

The DQL statements correctly correspond to the expected SQL output, covering the same test scenarios with proper formatting. The descriptive keys make it much easier to understand what each test is verifying.

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

24-26: Good coverage of JSONB existence operator

These test cases provide solid coverage for PostgreSQL's ??| operator (checks if any of the strings in the right array exist as top-level keys in the left JSONB):

  • Testing for a single key existence
  • Testing for existence of any of multiple keys
  • Testing with a parameterized approach

The descriptive keys significantly improve test readability and maintain consistency with other test files in this project.


33-35: DQL statements correctly match expected SQL output

The DQL statements are properly formed and align with the expected SQL statements, covering the same scenarios with appropriate syntax. The consistent naming between SQL and DQL test cases makes the test much more maintainable.

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

22-23: Good naming that clearly identifies test scenarios!

The descriptive keys "gets length of array with hardcoded dimension" and "gets length of array with parameterized dimension" make it much easier to understand what each SQL statement is testing. This matches well with PostgreSQL's array_length documentation, which shows these are the two primary use cases for this function.


30-31: Well-structured test cases for array_length function

These DQL statements appropriately test both hardcoded dimension access and parameterized dimension access, which covers the main ways array_length would be used in PostgreSQL. The descriptive keys align perfectly with the SQL statements in the getExpectedSqlStatements method above.

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

22-24: Clear and comprehensive test scenarios for array_prepend

The descriptive keys effectively communicate each test's purpose, covering the three main use cases for PostgreSQL's array_prepend function:

  1. Prepending string values
  2. Prepending numeric values
  3. Prepending parameterized values

This aligns well with PostgreSQL documentation examples for array_prepend.


31-33: Well-structured DQL statements with clear naming

The DQL statements match the expected SQL statements perfectly, with descriptive keys that clearly identify each test scenario. The test covers all relevant use cases for the array_prepend function - string values, numeric values, and parameterized values.

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

22-23: Good test coverage for array_cat function

The descriptive keys effectively communicate each test's purpose, and the tests cover the main use cases for PostgreSQL's array_cat function: concatenating two arrays and concatenating with a parameterized value. This aligns well with PostgreSQL documentation.


30-31: DQL statements match SQL expectations with clear scenario naming

The DQL statements directly correspond to the expected SQL statements, with descriptive keys that clearly identify each test scenario. The test appropriately covers concatenating both entity fields and parameterized values.

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

29-29: DQL statement matches SQL expectation with clear naming

The DQL statement corresponds to the expected SQL statement with a descriptive key that clearly identifies what this test is verifying. The implementation correctly tests the basic usage of the array_dimensions function.

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

22-24: Well-structured test cases with clear descriptions!

The descriptive keys clearly communicate the purpose of each test case, making the code more readable and maintainable. The tests appropriately cover the core functionality of PostgreSQL's array_append function with string elements, numeric elements, and parameterized values, which aligns with PostgreSQL documentation.


31-33: Consistent and well-documented DQL statements!

The DQL statements match perfectly with the expected SQL statements and use descriptive keys that clearly indicate what each test is verifying. This approach ensures consistency across test files and makes it easier to understand the test coverage.

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

22-24: Clear and comprehensive test cases for array_remove!

The descriptive keys effectively communicate the purpose of each test case and the tests cover all the essential variations of PostgreSQL's array_remove function - removing string elements, numeric elements, and using parameters. This follows the same pattern as other array function tests, maintaining consistency throughout the test suite.


31-33: Well-structured DQL statements with consistent naming!

The DQL statements properly match their SQL counterparts and follow the same descriptive naming pattern established in other test files. This consistency makes the test suite more maintainable and helps developers quickly understand what aspect of the function is being tested.

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

22-22: Good addition of descriptive key for improved clarity.

The descriptive key clearly communicates what the test is verifying, which enhances readability and aligns with the pattern established in other test files.

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

7-7: Good switch to ContainsTexts entity for more versatile casting tests

Changing from ContainsIntegers to ContainsTexts enables testing a broader range of data type conversions, as text values can be cast to more PostgreSQL data types than integers.


34-39:

✅ Verification successful

Enhanced DQL test cases with descriptive keys

The DQL statements now use clear, descriptive array keys that align with the SQL statements, making it easier to understand what each test is verifying. This is consistent with the changes observed in other test files and improves the overall test documentation.

Let's verify that the Cast function is properly registered in the library:


🏁 Script executed:

#!/bin/bash
# Check if the Cast function is properly registered in the library
rg -A 10 "class Cast" --type php

Length of output: 1960


Enhanced DQL tests and Cast registration verified

  • The updated test cases now use descriptive keys that clearly indicate the SQL cast type, aligning with similar changes in other test files.
  • A quick search confirms that the Cast function is properly registered in the library (located at src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/Cast.php), and the test class in tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/CastTest.php correctly maps 'CAST' => Cast::class.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php (1)

21-25: Good improvement to test readability!

The descriptive keys for each test scenario make it much clearer what functionality is being tested in each case. This change aligns well with the PR objective of adding descriptions to the tested query variations.

Comment on lines 30 to 34
return [
// Multiple literal values
\sprintf("SELECT ARRAY('foo', 'bar', 'baz') FROM %s e", ContainsArrays::class),
// Column references
\sprintf('SELECT ARRAY(e.array1) FROM %s e', ContainsArrays::class),
// Mix of column references and literals
\sprintf("SELECT ARRAY(e.array1, 'test-value', e.array2) FROM %s e", ContainsArrays::class),
'creates array from multiple literal values' => \sprintf("SELECT ARRAY('foo', 'bar', 'baz') FROM %s e", ContainsArrays::class),
'creates array from column references' => \sprintf('SELECT ARRAY(e.array1) FROM %s e', ContainsArrays::class),
'creates array from mix of column references and literals' => \sprintf("SELECT ARRAY(e.array1, 'test-value', e.array2) FROM %s e", ContainsArrays::class),
];
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider adding more comprehensive PostgreSQL ARRAY test cases

The current test cases cover the basic usage of PostgreSQL ARRAY constructor, but could be expanded to include additional PostgreSQL-specific functionality according to the official documentation:

  1. Creating arrays with NULL values: ARRAY[1, NULL, 3]
  2. Creating arrays with different data types: ARRAY[1, 'text', TRUE]
  3. Creating multidimensional arrays: ARRAY[[1,2], [3,4]]
  4. Testing empty arrays: ARRAY[]

These additional test cases would provide more comprehensive coverage of PostgreSQL's ARRAY functionality.


🌐 Web query:

PostgreSQL ARRAY constructor examples and use cases

💡 Result:

PostgreSQL's ARRAY constructor provides flexible ways to work with array data types, offering both direct syntax options and programmatic functionality. Here's a breakdown of key implementations:

Array Creation and Insertion

Basic array insertion can be done with either:

  • ARRAY[] constructor syntax
INSERT INTO contacts (phones) VALUES (ARRAY['(+1)555-1234', '(+1)555-5678']) [5]
  • Curly brace literals (requires single-quoted string)
INSERT INTO sal_emp (pay_by_quarter) VALUES ('{10000,10000,10000,10000}') [3]

Multidimensional arrays require consistent sub-array dimensions:

CREATE TABLE teams (
    id SERIAL PRIMARY KEY,
    members TEXT[][]
);
INSERT INTO teams VALUES (ARRAY[['Alice','Bob'], ['Carol','Dave']]) [1][3]

Mismatched dimensions trigger errors like:
ERROR: multidimensional arrays must have matching sub-array dimensions [3]


Array Querying and Manipulation

Element access uses 1-based indexing:

SELECT phones[1] FROM contacts WHERE name = 'John' [5]

Array searching with ANY():

SELECT * FROM contacts WHERE '(+1)555-1234' = ANY(phones) [5]

Using UNNEST() to expand arrays:

SELECT element FROM UNNEST(ARRAY['A','B','C']) AS t(element) [2]

Aggregation with ARRAY_AGG():

SELECT ARRAY_AGG(product) FROM orders [2]

Common Use Cases

  1. Storing multiple related values

    • Phone numbers for contacts [5][6]
    • Coordinates in GIS data (REAL[2] for lat/long) [4][5]
  2. Matrix/Grid Data

    • Team structures (2D text arrays) [1]
    • Financial quarters (integer[4]) [3]
  3. Temporary Data Handling

    • Using arrays with UNNEST for batch operations [2]
    • Simplifying complex joins in analytical queries

Key Functions

Function Usage Example Purpose
array_cat() array_cat(ARRAY[1,2], ARRAY[3,4]) Concatenates arrays [3][4]
array_length() array_length(phones, 1) Returns dimension length [4][5]
array_replace() array_replace(phones, 'old','new') Modifies element values [5]
array_remove() array_remove(phones, '(discontinued)') Deletes elements [5]

Implementation Notes

  • Performance: Arrays > 100 elements may benefit from GIN/GIST indexes [4]
  • Type Safety: All elements must match declared type (e.g., text[] won't accept integers)
  • Updating Arrays: Modify individual elements (phones[2] = '...') or entire arrays [5]

For most relational datasets, normalization remains preferable, but arrays shine in scenarios requiring ordered collections or when integrating with applications using array data structures.

Citations:


Expand PostgreSQL ARRAY Test Cases for Comprehensive Coverage

The current tests in tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php (lines 30–34) only validate basic usage of the ARRAY constructor. To better reflect PostgreSQL’s ARRAY functionality—as seen in standard usage examples—it would be beneficial to extend the test cases. Consider adding additional scenarios such as:

  • Arrays with NULL values: e.g., ARRAY[1, NULL, 3]
  • Arrays with mixed data types: e.g., ARRAY[1, 'text', TRUE]
  • Multidimensional arrays: e.g., ARRAY[[1,2], [3,4]]
  • Empty arrays: e.g., ARRAY[]

These extra tests would ensure robust coverage of both typical and edge-case behaviors.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants