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:
authormattab <matthieu.aubry@gmail.com>2015-03-19 10:41:52 +0300
committermattab <matthieu.aubry@gmail.com>2015-03-19 10:41:52 +0300
commit13523fa494bf35e949009c5e2e31559afe321573 (patch)
tree1469abf01faa0b1f1607c4fb10e62e9da67986c6
parent0dcd19441ffcc977c275f5d7823acf493f98a677 (diff)
Revert previous commit and add unit test
-rw-r--r--core/CronArchive/SegmentArchivingRequestUrlProvider.php6
-rw-r--r--tests/PHPUnit/Unit/CronArchive/SegmentArchivingRequestUrlProviderTest.php18
2 files changed, 12 insertions, 12 deletions
diff --git a/core/CronArchive/SegmentArchivingRequestUrlProvider.php b/core/CronArchive/SegmentArchivingRequestUrlProvider.php
index 9dafd9f66e..d43fc03ed5 100644
--- a/core/CronArchive/SegmentArchivingRequestUrlProvider.php
+++ b/core/CronArchive/SegmentArchivingRequestUrlProvider.php
@@ -64,8 +64,8 @@ class SegmentArchivingRequestUrlProvider
// if the start date for the archiving request is before the minimum date allowed for processing this segment,
// use the minimum allowed date as the start date
$periodObj = PeriodFactory::build($period, $date);
- $endDate = $periodObj->getDateEnd();
if ($periodObj->getDateStart()->getTimestamp() < $oldestDateToProcessForNewSegment->getTimestamp()) {
+ $endDate = $periodObj->getDateEnd();
// if the creation time of a segment is older than the end date of the archiving request range, we cannot
// blindly rewrite the date string, since the resulting range would be incorrect. instead we make the
@@ -74,8 +74,8 @@ class SegmentArchivingRequestUrlProvider
$oldestDateToProcessForNewSegment = $endDate;
}
+ $date = $oldestDateToProcessForNewSegment->toString().','.$endDate;
}
- $date = $oldestDateToProcessForNewSegment->toString().','.$endDate;
return $date;
}
@@ -84,7 +84,7 @@ class SegmentArchivingRequestUrlProvider
{
if ($this->processNewSegmentsFrom == self::CREATION_TIME) {
return $segmentCreatedTime;
- } else if (preg_match("/^last([0-9]*)$/", $this->processNewSegmentsFrom, $matches)) {
+ } else if (preg_match("/^last([0-9]+)$/", $this->processNewSegmentsFrom, $matches)) {
$lastN = $matches[1];
list($lastDate, $lastPeriod) = Range::getDateXPeriodsAgo($lastN, $segmentCreatedTime, 'day');
diff --git a/tests/PHPUnit/Unit/CronArchive/SegmentArchivingRequestUrlProviderTest.php b/tests/PHPUnit/Unit/CronArchive/SegmentArchivingRequestUrlProviderTest.php
index 2e0fe987df..e449024326 100644
--- a/tests/PHPUnit/Unit/CronArchive/SegmentArchivingRequestUrlProviderTest.php
+++ b/tests/PHPUnit/Unit/CronArchive/SegmentArchivingRequestUrlProviderTest.php
@@ -157,15 +157,6 @@ class SegmentArchivingRequestUrlProviderTest extends \PHPUnit_Framework_TestCase
"2011-12-22,2015-03-01"
),
- array( // test lastN rewinds created date by N = 1000 days
- 'last3000',
- 1,
- $dateRange,
- 'week',
- 'countryCode==us',
- "2003-10-15,2015-03-01"
- ),
-
array( // test lastN rewinds now by N days (testing w/ no found segment)
'last10',
3,
@@ -183,6 +174,15 @@ class SegmentArchivingRequestUrlProviderTest extends \PHPUnit_Framework_TestCase
'pageUrl==a',
'2015-02-22,2015-02-22'
),
+
+ array(
+ 'segment_creation_time',
+ 1,
+ '2015-02-01,' . self::TEST_NOW,
+ 'week',
+ 'countryCode==us',
+ '2015-02-01,2015-03-01'
+ ),
);
}