-
-
Notifications
You must be signed in to change notification settings - Fork 56
chore: improve tests #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: improve tests #340
Conversation
WalkthroughThis pull request updates the PHPUnit configuration and modifies several test classes. In the configuration file, one attribute is removed and five attributes are added to enhance test output details. Multiple test cases in the Doctrine DBAL/ORM suite have updated method visibilities or signatures (e.g., changing methods to Changes
Sequence Diagram(s)InArray Function TestsequenceDiagram
participant T as InArrayTest
participant F as InArray Function
participant S as SQL Translator
participant DB as Database
T->>F: Map "IN_ARRAY" function via getStringFunctions
F->>S: Convert DQL "IN_ARRAY" to SQL query
S->>DB: Execute generated SQL
DB-->>S: Return query result
S-->>F: Provide SQL statement
F-->>T: Deliver expected SQL and DQL outputs
RowToJson Function TestsequenceDiagram
participant T as RowToJsonTest
participant F as RowToJson Function
participant S as SQL Translator
participant DB as Database
T->>F: Map "ROW_TO_JSON" function via getStringFunctions
F->>S: Convert DQL "ROW_TO_JSON" to SQL query
S->>DB: Execute SQL query for JSON conversion
DB-->>S: Return transformation result
S-->>F: Provide SQL statement
F-->>T: Deliver expected outputs for SQL and DQL
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php (1)
55-55: Unused parameter in the method signature.You've added an optional parameter
?array $platformValue = nullto match the parameter structure ofcan_transform_from_php_value(), but this parameter is never used in the method implementation.Since the parameter isn't used, consider either:
- Removing it to keep the method signature clean and avoid confusion, or
- If it's intended for future use, add a comment explaining its purpose.
-public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue, ?array $platformValue = null): void +public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
ci/phpunit/config.xml(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php(2 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/InArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php(1 hunks)tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.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/RowToJsonTest.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/InArrayTest.php
🧬 Code Graph Analysis (5)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideOutOfRangeValues(84-90)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideOutOfRangeValues(70-76)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideOutOfRangeValues(70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideOutOfRangeValues(88-88)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideOutOfRangeValues(84-90)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideOutOfRangeValues(70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideOutOfRangeValues(88-88)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideOutOfRangeValues(84-90)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideOutOfRangeValues(70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideOutOfRangeValues(88-88)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideOutOfRangeValues(70-76)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideOutOfRangeValues(70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php (5)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
can_transform_to_php_value(59-62)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
can_transform_to_php_value(52-55)tests/MartinGeorgiev/Doctrine/DBAL/Types/TextArrayTest.php (1)
can_transform_to_php_value(51-54)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php (1)
can_transform_to_php_value(54-57)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php (1)
can_transform_to_php_value(51-54)
⏰ Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer latest
- GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 1.2
- GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
- GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
- GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
- GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer latest
- GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 2.1
- GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 2.1
- GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer latest
- GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer latest
- GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 2.1
- GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 3.0
- GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 3.0
- GitHub Check: PHP 8.1 + Doctrine ORM 3.0 + Doctrine Lexer latest
- GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
- GitHub Check: sloth
🔇 Additional comments (8)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
70-70: Good visibility and accessibility changeChanged method from
protectedtopublic staticto match the abstract method declaration inBaseIntegerArrayTestCase. This improves accessibility and follows PHPUnit best practices for data providers.tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
70-70: Appropriate visibility modifier changeChanged method from
protectedtopublic staticto match the abstract method declaration inBaseIntegerArrayTestCase. This aligns with PHPUnit best practices for data providers and creates consistency across all integer array test implementations.tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (2)
65-65: Good property key renaming for consistencyRenamed property key from
postgresJsonbtopostgresValueto match parameter names in the test methods and maintain consistency across test classes.
88-88: Appropriate property key renamingRenamed property key from
postgresJsonbtopostgresValueto match parameter names in test methods. This creates consistency with the property naming pattern used throughout the test suite.tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
88-88: Good abstract method declaration updateChanged abstract method declaration from
protectedtopublic static, enforcing a consistent pattern for data providers across all subclasses. This follows PHPUnit best practices where data providers should be static methods.tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
84-84: Good change to align with parent abstract method.The visibility change from
protectedtopublic staticcorrectly aligns with the abstract method declaration inBaseIntegerArrayTestCase.phpand makes the method signature consistent with other data providers in the codebase.ci/phpunit/config.xml (1)
12-16: Excellent improvement to test output visibility!These new attributes will make test failures much more transparent by showing detailed information about deprecations, errors, notices, and warnings. This is especially valuable for catching subtle issues that might be hidden in the test output.
tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (1)
124-124: Good fix to align PHPDoc with implementationThe updated return type annotation now correctly reflects the actual structure of the returned array, which only contains the
phpValuekey without apostgresValuekey. This improves code documentation accuracy and helps with static analysis.
- more descriptive provider method names - add missing exception handling tests
There was a problem hiding this 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 (4)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (2)
124-125: Fix the redundant data provider name.The data provider name
provideInvalidDatabaseValuesForPHPTransformationForPHPTransformationcontains a redundant "ForPHPTransformation" suffix.- * @dataProvider provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation + * @dataProvider provideInvalidDatabaseValuesForPHPTransformation
136-145: Fix the redundant method name.The method name
provideInvalidDatabaseValuesForPHPTransformationForPHPTransformationcontains a redundant "ForPHPTransformation" suffix.- public static function provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation(): array + public static function provideInvalidDatabaseValuesForPHPTransformation(): arrayThe test data cases themselves look comprehensive, covering various invalid MAC address scenarios.
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (2)
118-119: Fix the redundant data provider name.The data provider name
provideInvalidDatabaseValuesForPHPTransformationForPHPTransformationcontains a redundant "ForPHPTransformation" suffix.- * @dataProvider provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation + * @dataProvider provideInvalidDatabaseValuesForPHPTransformation
129-140: Fix the redundant method name.The method name
provideInvalidDatabaseValuesForPHPTransformationForPHPTransformationcontains a redundant "ForPHPTransformation" suffix.- public static function provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation(): array + public static function provideInvalidDatabaseValuesForPHPTransformation(): arrayThe test data cases themselves are comprehensive, covering various invalid CIDR notation scenarios.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
.github/workflows/ci.yml(2 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php(2 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php(3 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php(2 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php(3 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php(4 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php(3 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php(4 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php(2 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php(3 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php(3 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php(4 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php(2 hunks)tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
- tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php
- tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php
- tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php
- tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php
- tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php
- tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php
🧰 Additional context used
🧬 Code Graph Analysis (8)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (13)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-41)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(116-134)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(99-113)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(124-143)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(119-138)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(103-119)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(109-115)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(115-129)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (13)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-41)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (2)
provideInvalidPHPValuesForDatabaseTransformation(116-134)provideInvalidDatabaseValuesForPHPTransformation(150-156)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(99-113)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (2)
provideInvalidPHPValuesForDatabaseTransformation(124-143)provideInvalidDatabaseValuesForPHPTransformation(159-177)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(26-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(119-138)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(103-119)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(109-115)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (12)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(116-134)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(99-113)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(124-143)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(26-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(119-138)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(103-119)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(115-129)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (7)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(99-113)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(26-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(109-115)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (13)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-41)tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(99-113)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (2)
provideInvalidPHPValuesForDatabaseTransformation(124-143)provideInvalidDatabaseValuesForPHPTransformation(159-177)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(26-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(119-138)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(103-119)tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(109-115)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (2)
provideInvalidPHPValuesForDatabaseTransformation(115-129)provideInvalidDatabaseValuesForPHPTransformation(145-151)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (7)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(26-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidMacaddrArrayItemForPHPException.php (1)
InvalidMacaddrArrayItemForPHPException(14-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (3)
src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidInetForDatabaseException.php (1)
InvalidInetForDatabaseException(14-30)tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (2)
provideInvalidPHPValuesForDatabaseTransformation(119-138)throws_exception_when_invalid_data_provided_to_convert_to_php_value(145-150)src/MartinGeorgiev/Doctrine/DBAL/Types/Inet.php (1)
convertToPHPValue(43-58)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (8)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-33)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
provideInvalidPHPValuesForDatabaseTransformation(28-42)tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(26-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(25-35)tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
provideInvalidPHPValuesForDatabaseTransformation(24-32)src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidInetArrayItemForPHPException.php (1)
InvalidInetArrayItemForPHPException(14-35)src/MartinGeorgiev/Doctrine/DBAL/Types/Inet.php (1)
convertToPHPValue(43-58)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 1.2
- GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer latest
- GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 2.1
- GitHub Check: sloth
🔇 Additional comments (31)
.github/workflows/ci.yml (3)
4-8: Good addition of CI trigger for the main branchAdding a
pushtrigger for the main branch with appropriate path exclusions ensures that CI runs when code is directly pushed to main, which is a good practice for maintaining code quality.
27-27: Improved clarity in the skip messageThe new message is more precise about why CI checks are being skipped, clearly stating it's due to the release-please bot's interaction.
30-30: Enhanced clarity in the execution messageThe updated message clearly indicates that CI checks will execute because the actor is not the release-please bot, which provides better context for troubleshooting.
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (2)
18-18: Improved data provider annotation namingThe renamed data provider is more descriptive and accurately reflects its purpose of providing invalid PHP values specifically for database transformation.
28-28: More descriptive method namingRenaming to
provideInvalidPHPValuesForDatabaseTransformationclearly communicates the method's purpose and follows the pattern used throughout the test suite.tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (2)
25-25: Consistent method namingThe method signature has been updated to match the naming convention used in the parent class and other test files, providing better clarity and consistency.
27-27: Updated parent method callThe parent method call has been correctly updated to reflect the renamed method in the parent class, maintaining the inheritance chain.
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (2)
26-26: Consistent method namingThe method signature has been updated to match the naming convention used in the parent class and other test files, providing better clarity and consistency.
28-28: Updated parent method callThe parent method call has been correctly updated to reflect the renamed method in the parent class, maintaining the inheritance chain.
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (4)
104-104: Good method name clarification.Renaming the data provider reference from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationimproves clarity by explicitly indicating what kind of invalid values are being tested.
115-129: Improved method naming.The method name change from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationmakes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.
134-135: Good method name clarification.Renaming the data provider reference from
provideInvalidDatabaseValuestoprovideInvalidDatabaseValuesForPHPTransformationmakes the test intention clearer - it's testing database-to-PHP conversions with invalid data.
145-151: Improved method naming.The method name change from
provideInvalidDatabaseValuestoprovideInvalidDatabaseValuesForPHPTransformationbetter describes the purpose of this data provider and maintains consistency with the naming pattern used throughout the tests.tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (4)
105-106: Good method name clarification.Renaming the data provider reference from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationimproves clarity by explicitly indicating what kind of invalid values are being tested.
116-134: Improved method naming.The method name change from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationmakes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.
139-140: Good method name clarification.Renaming the data provider reference from
provideInvalidDatabaseValuestoprovideInvalidDatabaseValuesForPHPTransformationmakes the test intention clearer - it's testing database-to-PHP conversions with invalid data.
150-156: Improved method naming.The method name change from
provideInvalidDatabaseValuestoprovideInvalidDatabaseValuesForPHPTransformationbetter describes the purpose of this data provider and maintains consistency with the naming pattern used throughout the tests.tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (3)
92-93: Good method name clarification.Renaming the data provider reference from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationimproves clarity by explicitly indicating what kind of invalid values are being tested.
103-119: Improved method naming.The method name change from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationmakes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.
121-131: Good addition of PHP conversion test.Adding this test method enhances test coverage by verifying that invalid database values are properly rejected when converting to PHP types.
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (3)
88-89: Good method name clarification.Renaming the data provider reference from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationimproves clarity by explicitly indicating what kind of invalid values are being tested.
99-113: Improved method naming.The method name change from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformationmakes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.
115-124: Good addition of PHP conversion test.Adding this test method enhances test coverage by verifying that invalid database values are properly rejected when converting to PHP types.
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (6)
8-8: Good addition of missing import.The import for
InvalidInetForDatabaseExceptionis correctly added to support the new test method for validating conversions from database to PHP values.
113-113: Improved method reference in docblock.The data provider reference has been updated from
provideInvalidTransformationstoprovideInvalidPHPValuesForDatabaseTransformation, which provides better naming clarity and aligns with other test classes in the codebase.
124-124: Good conversion to static method.Changing the data provider to
public staticfollows best practices for PHPUnit data providers, as they don't require instance state and can be more efficiently used across test runs.
127-127: Improved test coverage with non-string value test case.Adding a test case for non-string values (123) strengthens the test coverage by ensuring the code properly handles numeric inputs.
145-154: Good addition of database-to-PHP conversion test.This new test method properly verifies that exceptions are thrown when invalid data is provided for conversion from database values to PHP values, complementing the existing PHP-to-database conversion test.
156-177: Comprehensive data provider for invalid database values.The new data provider includes a thorough set of test cases covering various invalid inputs, enhancing the robustness of the test suite. The test cases align well with the implementation in
Inet::convertToPHPValue().tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (2)
108-108: Improved method reference in docblock.The data provider reference has been consistently updated to
provideInvalidPHPValuesForDatabaseTransformation, maintaining naming clarity across the test suite.
119-119: Good conversion to static method.Converting the data provider to
public staticis a good practice for PHPUnit data providers, improving efficiency and consistency with other test classes.
| * @return array<string, array{string}> | ||
| */ | ||
| public static function provideInvalidDatabaseValuesForPHPTransformationForDatabaseTransformation(): array | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Return type annotation should allow for mixed values.
The current return type annotation only allows for string values, but to test non-string inputs, it should allow for mixed values.
- @return array<string, array{string}>
+ @return array<string, array{mixed}>Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be correct based on the provider data, and PHPStan will scream at you. Or maybe not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martin-georgiev You're absolutely right. The suggestion to change to `array
<string, array{mixed}>` would be incorrect and PHPStan would indeed flag it.
Looking at your test method:
public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): voidThe parameter is typed as string $postgresValue, so the data provider must return string values. Since all your test cases in the provider return strings (like '{"invalid-ip"}'), the current annotation @return array<string, array{string}> is correct.
The mixed type would only be appropriate if your test method parameter was typed as mixed (like in your other test method).
| return [ | ||
| 'invalid format' => ['{"invalid-ip"}'], | ||
| 'invalid IPv4 in array' => ['{"256.256.256.256"}'], | ||
| 'invalid IPv6 in array' => ['{"2001:xyz::1"}'], | ||
| 'malformed array' => ['not-an-array'], | ||
| 'empty item in array' => ['{"192.168.1.1",""}'], | ||
| 'invalid item in array' => ['{"192.168.1.1","invalid-ip"}'], | ||
| 'invalid CIDR in array' => ['{"192.168.1.0/33"}'], | ||
| 'incomplete IPv4 in array' => ['{"192.168.1"}'], | ||
| 'incomplete IPv6 in array' => ['{"2001:db8"}'], | ||
| ]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add non-string test case to match parameter type change.
To fully test invalid inputs, consider adding a non-string test case similar to the one in InetTest.
return [
+ 'non-string value' => [123],
'invalid format' => ['{"invalid-ip"}'],
'invalid IPv4 in array' => ['{"256.256.256.256"}'],
// ...existing test cases...
];📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return [ | |
| 'invalid format' => ['{"invalid-ip"}'], | |
| 'invalid IPv4 in array' => ['{"256.256.256.256"}'], | |
| 'invalid IPv6 in array' => ['{"2001:xyz::1"}'], | |
| 'malformed array' => ['not-an-array'], | |
| 'empty item in array' => ['{"192.168.1.1",""}'], | |
| 'invalid item in array' => ['{"192.168.1.1","invalid-ip"}'], | |
| 'invalid CIDR in array' => ['{"192.168.1.0/33"}'], | |
| 'incomplete IPv4 in array' => ['{"192.168.1"}'], | |
| 'incomplete IPv6 in array' => ['{"2001:db8"}'], | |
| ]; | |
| } | |
| return [ | |
| 'non-string value' => [123], | |
| 'invalid format' => ['{"invalid-ip"}'], | |
| 'invalid IPv4 in array' => ['{"256.256.256.256"}'], | |
| 'invalid IPv6 in array' => ['{"2001:xyz::1"}'], | |
| 'malformed array' => ['not-an-array'], | |
| 'empty item in array' => ['{"192.168.1.1",""}'], | |
| 'invalid item in array' => ['{"192.168.1.1","invalid-ip"}'], | |
| 'invalid CIDR in array' => ['{"192.168.1.0/33"}'], | |
| 'incomplete IPv4 in array' => ['{"192.168.1"}'], | |
| 'incomplete IPv6 in array' => ['{"2001:db8"}'], | |
| ]; | |
| } |
not applicable at this point
…Types/InetArrayTest.php" This reverts commit d56f1f0.
Summary by CodeRabbit