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

Add adjustTime to FrozenClock #689

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

lgrossi
Copy link
Contributor

@lgrossi lgrossi commented Jul 4, 2024

Minor helper that simplifies FrozenClock usage during test setup, allowing to modify the clock based on a given modifier.

Benefit:

// instead of
$this->clock->setTo($this->clock->now()->modify('+60 seconds'))

// we can do
$this->clock->adjustTime('+60 seconds');

@lcobucci lcobucci added this to the 3.3.0 milestone Jul 4, 2024
@lcobucci lcobucci self-assigned this Jul 4, 2024
@lgrossi lgrossi force-pushed the lucas/minor-frozen-clock-helpers branch from 7f6238c to efba1f7 Compare July 4, 2024 09:45
src/FrozenClock.php Outdated Show resolved Hide resolved
src/FrozenClock.php Outdated Show resolved Hide resolved
src/FrozenClock.php Outdated Show resolved Hide resolved
@lgrossi lgrossi force-pushed the lucas/minor-frozen-clock-helpers branch from efba1f7 to c6f552d Compare July 4, 2024 11:16
@lgrossi lgrossi changed the title Add modify and default constructor to FrozenClock Add adjustTime to FrozenClock Jul 4, 2024
@lgrossi lgrossi force-pushed the lucas/minor-frozen-clock-helpers branch 3 times, most recently from a724f49 to 35c4690 Compare July 4, 2024 11:26
src/MalformedDateString.php Outdated Show resolved Hide resolved
@lcobucci lcobucci force-pushed the lucas/minor-frozen-clock-helpers branch from 35c4690 to 47cb7d3 Compare September 24, 2024 20:37
@lcobucci lcobucci merged commit 049ecee into lcobucci:3.3.x Sep 24, 2024
18 checks passed
@lcobucci
Copy link
Owner

@lgrossi thanks!

throw new InvalidArgumentException('The given modifier is invalid');
}

$this->now = $this->now->modify($modifier);
Copy link
Owner

Choose a reason for hiding this comment

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

I just noticed that I didn't update this 🤦
Silly me...

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.

2 participants