Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Sep 5, 2025

Summary by CodeRabbit

  • Chores
    • Updated code quality tooling configuration to enforce consistent PHPUnit usage. No runtime or feature impact for end-users.
  • Tests
    • Refined unit tests to align with updated testing conventions, improving consistency and maintainability without changing behavior or coverage.

@coderabbitai
Copy link

coderabbitai bot commented Sep 5, 2025

Walkthrough

Adds a Rector rule (PreferPHPUnitThisCallRector) to the Rector config and updates PHPUnit tests to use instance-based expectation syntax ($this->once()) instead of static (self::once()) in two test files. No production code changes.

Changes

Cohort / File(s) Summary
Rector configuration
ci/rector/config.php
Imports PreferPHPUnitThisCallRector and enables it via withRules; existing sets/paths/skip remain unchanged.
PHPUnit expectation updates
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php, tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php
Replace self::once() with $this->once() for mock expectations; no other test logic changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Bunny taps the keys with cheer,
“From self to this, the mocks are clear!”
Rector hums, configs align,
Tests now hop in perfect time.
Carrot-shaped green checks appear 🥕✅


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f011b54 and a231312.

📒 Files selected for processing (3)
  • ci/rector/config.php (2 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php (1 hunks)
  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-08-24T16:52:32.488Z
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#0
File: :0-0
Timestamp: 2025-08-24T16:52:32.488Z
Learning: This repository uses BaseType extension pattern for custom Doctrine DBAL types with PostgreSQL platform assertions, comprehensive unit and integration testing with data providers, and dedicated exception classes for type conversion errors.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php
📚 Learning: 2025-05-23T11:11:57.951Z
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#383
File: tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RadiansTest.php:1-9
Timestamp: 2025-05-23T11:11:57.951Z
Learning: Tests in the `Tests\Unit\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\Unit\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), rather than PHPUnit's TestCase directly, and therefore don't need an explicit import.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php
📚 Learning: 2025-03-29T03:31:17.114Z
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#318
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/XmlAggTest.php:1-9
Timestamp: 2025-03-29T03:31:17.114Z
Learning: Tests in the `Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), not PHPUnit's TestCase, and therefore don't need an explicit import statement.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php
📚 Learning: 2025-03-29T03:31:17.114Z
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#318
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/XmlAggTest.php:1-9
Timestamp: 2025-03-29T03:31:17.114Z
Learning: Tests in the `Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), rather than PHPUnit's TestCase, and therefore don't need an explicit import.

Applied to files:

  • tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: Code Quality
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 3.0 + 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: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: sloth
  • GitHub Check: PostgreSQL 16 + PostGIS 3.5 + PHP 8.3
  • GitHub Check: PostgreSQL 17 + PostGIS 3.4 + PHP 8.3
  • GitHub Check: PostgreSQL 16 + PostGIS 3.4 + PHP 8.3
  • GitHub Check: PostgreSQL 16 + PostGIS 3.4 + PHP 8.1
  • GitHub Check: PostgreSQL 17 + PostGIS 3.5 + PHP 8.1
  • GitHub Check: PostgreSQL 17 + PostGIS 3.5 + PHP 8.2
  • GitHub Check: PostgreSQL 17 + PostGIS 3.4 + PHP 8.2
  • GitHub Check: PostgreSQL 16 + PostGIS 3.5 + PHP 8.1
  • GitHub Check: PostgreSQL 16 + PostGIS 3.4 + PHP 8.2
  • GitHub Check: PostgreSQL 17 + PostGIS 3.4 + PHP 8.1
  • GitHub Check: wait-for-tests-worflows-before-upload
🔇 Additional comments (4)
tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php (1)

95-95: Good switch to instance-based expectation

Using $this->once() aligns with PHPUnit’s preferred style and the Rector rule intent. No functional change.

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php (1)

69-69: LGTM: instance-based expectation

$this->once() is the correct, idiomatic usage here.

ci/rector/config.php (2)

9-9: Import looks correct for the enabled rule

The PreferPHPUnitThisCallRector FQCN is correct for modern Rector namespaces.


42-44: Verification complete – no static PHPUnit expectations found
Sweep detected no remaining self::once|never|any|exactly|atLeastOnce calls; rule can be merged.

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

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

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coveralls
Copy link

Coverage Status

coverage: 95.104%. remained the same
when pulling a231312 on rector
into f011b54 on main.

@martin-georgiev martin-georgiev merged commit b543ee8 into main Sep 5, 2025
68 of 69 checks passed
@martin-georgiev martin-georgiev deleted the rector branch September 5, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants