Skip to content

Conversation

@pfefferle
Copy link
Member

Fixes #

Proposed changes:

  • Replace $this->factory with self::factory() in test files to follow PHPUnit best practices

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Run the test suite with npm run env-test
  • Verify all tests pass with the updated factory syntax

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Replace $this->factory with self::factory() in test files to follow
PHPUnit best practices for factory usage.
Copilot AI review requested due to automatic review settings December 1, 2025 08:14
@pfefferle pfefferle self-assigned this Dec 1, 2025
@pfefferle pfefferle requested a review from a team December 1, 2025 08:14
@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Dec 1, 2025
Copilot finished reviewing on behalf of pfefferle December 1, 2025 08:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates test factory usage across multiple test files to follow PHPUnit best practices by replacing instance property access ($this->factory) with static method calls (self::factory()).

Key changes:

  • Updated factory access pattern from $this->factory to self::factory() in all test methods
  • Changes are consistent across 8 test files covering integration tests, transformer tests, and handler tests
  • All instances of the old pattern have been successfully migrated

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/phpunit/tests/integration/class-test-stream-connector.php Updated 2 factory calls in outbox processing test methods
tests/phpunit/tests/integration/class-test-akismet.php Updated 2 factory calls in comment creation tests
tests/phpunit/tests/includes/transformer/class-test-post.php Updated 8 factory calls across various post transformer tests
tests/phpunit/tests/includes/transformer/class-test-base.php Updated 1 factory call in audience setting test
tests/phpunit/tests/includes/handler/class-test-undo.php Updated 1 factory call in comment activity test
tests/phpunit/tests/includes/handler/class-test-reject.php Updated 2 factory calls in reject handler test
tests/phpunit/tests/includes/handler/class-test-accept.php Updated 2 factory calls in accept handler test
tests/phpunit/tests/includes/class-test-search.php Updated 1 factory call in search test

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@pfefferle pfefferle requested a review from obenland December 1, 2025 12:52
@pfefferle pfefferle merged commit ba72c37 into trunk Dec 1, 2025
15 checks passed
@pfefferle pfefferle deleted the update/test-factory-usage branch December 1, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants