Skip to content

[docs] Add best practice on using relfection in tests.#1590

Merged
paulholden merged 1 commit into
moodle:mainfrom
kabalin:reflection
May 15, 2026
Merged

[docs] Add best practice on using relfection in tests.#1590
paulholden merged 1 commit into
moodle:mainfrom
kabalin:reflection

Conversation

@kabalin
Copy link
Copy Markdown
Collaborator

@kabalin kabalin commented May 10, 2026

Copilot AI review requested due to automatic review settings May 10, 2026 22:59
@netlify
Copy link
Copy Markdown

netlify Bot commented May 10, 2026

Deploy Preview for moodledevdocs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c192ec9
🔍 Latest deploy log https://app.netlify.com/projects/moodledevdocs/deploys/6a07028e4cc14700082b81af
😎 Deploy Preview https://deploy-preview-1590--moodledevdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

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

Adds a new unit-testing best-practice section to Moodle DevDocs, aiming to discourage the use of reflection in tests and encourage designs that preserve encapsulation.

Changes:

  • Introduces a new “Respect encapsulation” subsection under “Best practice”.
  • Provides guidance on avoiding reflection/visibility changes and preferring public APIs (with suggested alternatives).

Comment thread docs/guides/testing/index.md Outdated
Comment thread docs/guides/testing/index.md Outdated
Comment thread docs/guides/testing/index.md
@paulholden paulholden self-requested a review May 15, 2026 07:57
Comment thread docs/guides/testing/index.md
Comment thread docs/guides/testing/index.md Outdated
@kabalin
Copy link
Copy Markdown
Collaborator Author

kabalin commented May 15, 2026

@paulholden thanks for review, I addressed behaviour and also referred to ReflectionClass just to make it more apparent for less experienced devs what reflection is about.

Copy link
Copy Markdown
Member

@paulholden paulholden left a comment

Choose a reason for hiding this comment

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

Thanks Ruslan!

@paulholden paulholden added this pull request to the merge queue May 15, 2026
Merged via the queue into moodle:main with commit e8f7e5d May 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants