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>2013-11-01 06:01:21 +0400
committermattab <matthieu.aubry@gmail.com>2013-11-01 06:01:21 +0400
commitdc4c9bfd0b381325ca1f6d7b3a506e1149c0280c (patch)
tree208c7bfde3c73996e14138b168e67e8cf9d292df /tests/PHPUnit/Core/Period/RangeTest.php
parenta13d81c2bea9132f54bb2e9bd3312841a0597e81 (diff)
Adding failing test for date range
Diffstat (limited to 'tests/PHPUnit/Core/Period/RangeTest.php')
-rw-r--r--tests/PHPUnit/Core/Period/RangeTest.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/PHPUnit/Core/Period/RangeTest.php b/tests/PHPUnit/Core/Period/RangeTest.php
index 74c350b51b..d386ec2b99 100644
--- a/tests/PHPUnit/Core/Period/RangeTest.php
+++ b/tests/PHPUnit/Core/Period/RangeTest.php
@@ -417,6 +417,94 @@ class Period_RangeTest extends PHPUnit_Framework_TestCase
$this->assertEquals($correct, $range->toString());
}
+ /**
+ * @group Core
+ */
+ public function testRangePreviousmonth_onLastDayOfMonth()
+ {
+ $end = Date::factory('2013-10-31');
+ $range = new Range('month', 'previous10', 'UTC', $end);
+ $end = $end->subMonth(1);
+
+ $correct = array();
+ for ($i = 0; $i < 10; $i++) {
+ $date = $end->subMonth($i);
+ $week = new Month($date);
+
+ $correct[] = $week->toString();
+ }
+ $correct = array_reverse($correct);
+
+ $this->assertEquals(10, $range->getNumberOfSubperiods());
+ $this->assertEquals($correct, $range->toString());
+ }
+
+ /**
+ * @group Core
+ */
+ public function testRangeLastmonth_onLastDayOfMonth()
+ {
+ $end = Date::factory('2013-10-31');
+ $range = new Range('month', 'last10', 'UTC', $end);
+
+ $correct = array();
+ for ($i = 0; $i < 10; $i++) {
+ $date = $end->subMonth($i);
+ $week = new Month($date);
+
+ $correct[] = $week->toString();
+ }
+ $correct = array_reverse($correct);
+
+ $this->assertEquals(10, $range->getNumberOfSubperiods());
+ $this->assertEquals($correct, $range->toString());
+ }
+
+ /**
+ * @group Core
+ */
+ public function _testRangePreviousmonth_onFirstOfMonth()
+ {
+ $end = Date::factory('2013-11-01');
+ $range = new Range('month', 'previous10', 'UTC', $end);
+ $end = $end->subMonth(1);
+
+ $correct = array();
+ for ($i = 0; $i < 10; $i++) {
+ $date = $end->subMonth($i);
+ $week = new Month($date);
+
+ $correct[] = $week->toString();
+ }
+ $correct = array_reverse($correct);
+
+
+ $this->assertEquals(10, $range->getNumberOfSubperiods());
+ $this->assertEquals($correct, $range->toString());
+ }
+
+ /**
+ * @group Core
+ */
+ public function _testRangeLastmonth_onFirstOfMonth()
+ {
+ $end = Date::factory('2013-11-01');
+ $range = new Range('month', 'last10', 'UTC', $end);
+
+ $correct = array();
+ for ($i = 0; $i < 10; $i++) {
+ $date = $end->subMonth($i);
+ $week = new Month($date);
+
+ $correct[] = $week->toString();
+ }
+ $correct = array_reverse($correct);
+
+
+ $this->assertEquals(10, $range->getNumberOfSubperiods());
+ $this->assertEquals($correct, $range->toString());
+ }
+
// test range YEAR
/**
* @group Core