Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-02-03 06:17:11 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-02-03 06:17:11 +0400
commitc1f3f9c3d675ab40b3a1a7b73bcbbace2e42165c (patch)
tree9e75ff94b1d482761e2d4a41b0ffbe44703861c3
parentf82bf3c9715df2923b390461cc421433d59490b1 (diff)
fix expected date for auckland / new zealand was wrong
-rw-r--r--core/ScheduledTime.php7
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/DailyTest.php2
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php2
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php2
4 files changed, 8 insertions, 5 deletions
diff --git a/core/ScheduledTime.php b/core/ScheduledTime.php
index 5060a33d56..53e1e86793 100644
--- a/core/ScheduledTime.php
+++ b/core/ScheduledTime.php
@@ -138,12 +138,15 @@ abstract class ScheduledTime
$dateInTimezone = Date::factory($arbitraryDateInUTC, $this->timezone);
$midnightInTimezone = date('H', $dateInTimezone->getTimestamp());
- $hoursDifference = (24 - $midnightInTimezone) % 24;
if ($arbitraryDateInUTC->isEarlier($dateInTimezone)) {
- $hoursDifference = -1 * $hoursDifference;
+ $hoursDifference = 0 - $midnightInTimezone;
+ } else {
+ $hoursDifference = 24 - $midnightInTimezone;
}
+ $hoursDifference = $hoursDifference % 24;
+
$rescheduledTime += (3600 * $hoursDifference);
if ($this->getTime() > $rescheduledTime) {
diff --git a/tests/PHPUnit/Core/ScheduledTime/DailyTest.php b/tests/PHPUnit/Core/ScheduledTime/DailyTest.php
index c825cbfb6f..a63302cffc 100644
--- a/tests/PHPUnit/Core/ScheduledTime/DailyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/DailyTest.php
@@ -101,7 +101,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
$mock->setTimezone('Pacific/Auckland');
$timeAuckland = $mock->getRescheduledTime();
- $this->assertEquals(-11 * $oneHourInSeconds, $timeAuckland - $timeUTC);
+ $this->assertEquals(-13 * $oneHourInSeconds, $timeAuckland - $timeUTC);
$mock->setTimezone('America/Los_Angeles');
diff --git a/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php b/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php
index 5c837cdd31..2f26d083c3 100644
--- a/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php
@@ -112,7 +112,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
$mock->setTimezone('Pacific/Auckland');
$timeAuckland = $mock->getRescheduledTime();
- $this->assertEquals(-11 * $oneHourInSeconds, $timeAuckland - $timeUTC);
+ $this->assertEquals(-13 * $oneHourInSeconds, $timeAuckland - $timeUTC);
$mock->setTimezone('America/Los_Angeles');
diff --git a/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php b/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php
index ecf5bbaf58..46bf3725cc 100644
--- a/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php
@@ -148,7 +148,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
$mock->setTimezone('Pacific/Auckland');
$timeAuckland = $mock->getRescheduledTime();
- $this->assertEquals(-11 * $oneHourInSeconds, $timeAuckland - $timeUTC);
+ $this->assertEquals(-13 * $oneHourInSeconds, $timeAuckland - $timeUTC);
$mock->setTimezone('America/Los_Angeles');