Skip to content

Commit

Permalink
Renamed Clock.setTimezone() to Clock.withTimezone()
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Feb 10, 2017
1 parent 74fccd6 commit e0c3cbc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -19,7 +19,7 @@ Enhancements:
* [Utilities] `Json::decode()` and `Json::encode()` will from now on, throw exceptions on invalid input.
* [Utilities] Added `Json::safeDecode()` and `Json::safeEncode()`.
* [Utilities] You can now read URL parameters as controllers' method arguments (issue #244).
* [Utilities] `Clock.setTimezone()` accepts both `string` or `DateTimeZone`.
* [Utilities] `Clock.useTimezone()` accepts both `string` or `DateTimeZone`.
* [Debug] After `renderPartial()`, you can now find `PARTIAL` and `END PARTIAL` HTML comments along with partial name.

Bug fixes:
Expand Down
2 changes: 1 addition & 1 deletion src/Ouzo/Goodies/Utilities/Clock.php
Expand Up @@ -205,7 +205,7 @@ public function isBeforeOrEqualTo(Clock $other)
* @param string|DateTimeZone $timezone
* @return Clock
*/
public function setTimezone($timezone)
public function withTimezone($timezone)
{
$freshDateTime = clone $this->dateTime;
if (is_string($timezone)) {
Expand Down
4 changes: 2 additions & 2 deletions test/src/Ouzo/Goodies/Utilities/ClockTest.php
Expand Up @@ -157,7 +157,7 @@ public function shouldChangeIfDateIsBeforeAnotherDate()
public function shouldCreateClockForGivenTimestamp()
{
//given
$clock = Clock::fromTimestamp(1427207001)->setTimezone('UTC');
$clock = Clock::fromTimestamp(1427207001)->withTimezone('UTC');

//when
$result = $clock->format();
Expand Down Expand Up @@ -192,7 +192,7 @@ public function shouldNotModifyTimeZone()
$clock = new Clock($dateTime);

// when
$modifiedClock = $clock->setTimezone('UTC');
$modifiedClock = $clock->withTimezone('UTC');

// then
Assert::that($dateTime->getTimezone())->isEqualTo(new DateTimeZone('Europe/Warsaw'));
Expand Down

0 comments on commit e0c3cbc

Please sign in to comment.