Skip to content
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

Allow better subclassing of MoneyField #11150

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

beerbohmdo
Copy link
Contributor

@beerbohmdo beerbohmdo commented Feb 16, 2024

Description

Move generation of NumberField from constructor to method to allow override in subclass.

Manual testing steps

Issues

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Seems sensible. Thanks for contributing!

Couple of small changes.
If there's an existing test for buildCurrencyField(), please add one for the new method as well.

your pr description

Please fill in all sections of the template, including linking to an issue.
If no issue currently exists, please create one. We track issues, not pull requests.

Please also tick all of the check boxes that apply - if you find that you can't tick a checkbox it probably means there's some more work for you to do (e.g. the commit message doesn't match the guidelines right now)

src/Forms/MoneyField.php Outdated Show resolved Hide resolved
src/Forms/MoneyField.php Outdated Show resolved Hide resolved
@beerbohmdo beerbohmdo force-pushed the allow_override_moneyfield branch 3 times, most recently from 9b65a38 to e237349 Compare February 19, 2024 10:11
@beerbohmdo
Copy link
Contributor Author

If there's an existing test for buildCurrencyField(), please add one for the new method as well.

There was no test for this method, I am not even sure what you wan't to test here. Nevertheless, I've added two test methods.

I will create a issue for this.

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Thank you for the tests, that's fantastic! Exactly what I was after.

Just a couple of small things to tidy up, then I'll be happy to merge this.

src/Forms/MoneyField.php Outdated Show resolved Hide resolved
tests/php/Forms/MoneyFieldTest.php Outdated Show resolved Hide resolved
tests/php/Forms/MoneyFieldTest.php Outdated Show resolved Hide resolved
Move generation of NumberField from constructor to method to allow override in subclass.
Addded test for MoneyField
@beerbohmdo beerbohmdo force-pushed the allow_override_moneyfield branch from e237349 to a3ce922 Compare February 20, 2024 10:43
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Fantastic, thank you for implementing this and for your patience.

@GuySartorelli GuySartorelli merged commit c2b606c into silverstripe:5 Feb 25, 2024
15 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.

2 participants