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

Make FrozenClock mutable through setter #1

Merged
merged 1 commit into from
Jan 19, 2018
Merged

Make FrozenClock mutable through setter #1

merged 1 commit into from
Jan 19, 2018

Conversation

frankkoornstra
Copy link

Because the FrozenClock is often injected in other objects during
testing, being able to change the current time on the FrozenClock
without reinjecting it in the object under test is quite useful.

Copy link
Owner

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

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

Thanks @frankkoornstra, just some small changes 😄

@@ -18,6 +18,11 @@ public function __construct(DateTimeImmutable $now)
$this->now = $now;
}

public function setTo(DateTimeImmutable $now)
Copy link
Owner

Choose a reason for hiding this comment

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

: void please

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

* @test
*
* @covers \Lcobucci\Clock\FrozenClock::setTo
* @covers \Lcobucci\Clock\FrozenClock::now
Copy link
Owner

Choose a reason for hiding this comment

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

\Lcobucci\Clock\FrozenClock::now should be marked as @uses instead of @covers.

Copy link
Owner

Choose a reason for hiding this comment

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

We also need to add @uses \Lcobucci\Clock\FrozenClock::__construct

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@lcobucci lcobucci self-assigned this Jan 19, 2018
@lcobucci lcobucci added this to the 1.1.0 milestone Jan 19, 2018
Because the FrozenClock is often injected in other objects during
testing, being able to change the current time on the FrozenClock
without reinjecting it in the object under test is quite useful.
@lcobucci lcobucci merged commit d11d20b into lcobucci:master Jan 19, 2018
@lcobucci lcobucci deleted the feature/frozen-clock-setter branch January 19, 2018 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants