-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
sync clock #863
base: main
Are you sure you want to change the base?
sync clock #863
Conversation
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.
For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
* fix: Ensure name_filter are local scoped * fix test on macos
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.
Also we should have a comment in the students stub that missing methods need to be added.
public function testOnTheHour(): void | ||
{ | ||
$clock = new Clock(8); | ||
|
||
$this->assertEquals('08:00', $clock->__toString()); | ||
$this->assertEquals('08:00', $clock); |
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 is one of the magic tricks in PHP, but we currently have no concept (concept exercise) for students to learn this. So we should either explain the magic in the stub (for now) or explicitly call the method as done before:
$this->assertEquals('08:00', $clock); | |
$this->assertEquals('08:00', $clock->__toString()); |
or
$this->assertEquals('08:00', $clock); | |
$this->assertEquals('08:00', (string)$clock); | |
// plus use `implements Stringable` in the students stub | |
// plus a comment in the stub pointing to PHP docs on interface `Stringable` |
@homersimpsons What do you think about this?
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.
If we want to show magic methods with this exercise, I think I would prefer the explicit (string)
cast, it has the advantages to clearly show that this method is magic.
But I do not know if we want to show those here.
I believe we could have a concept to show __toString
, __set
, __get
which I think are rather "common". __construct
is a magic method but I believe it is already being taught.
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.
These changes are not connected to the discussion about the magic method usage.
Please add a comment to the students stub, that all missing methods need to be added by the student.
Co-authored-by: mk-mxp <[email protected]>
Co-authored-by: mk-mxp <[email protected]>
Co-authored-by: mk-mxp <[email protected]>
Co-authored-by: mk-mxp <[email protected]>
Co-authored-by: mk-mxp <[email protected]>
Resolves #845