diff --git a/plugins/SecurityInfo b/plugins/SecurityInfo index a5e2f32fa4c807c351b0a726ee28a181b56fe7c9..fd8f764b9b6af55ed821aa6737a88d43ba3e76ac 160000 --- a/plugins/SecurityInfo +++ b/plugins/SecurityInfo @@ -1 +1 @@ -Subproject commit a5e2f32fa4c807c351b0a726ee28a181b56fe7c9 +Subproject commit fd8f764b9b6af55ed821aa6737a88d43ba3e76ac diff --git a/plugins/TreemapVisualization b/plugins/TreemapVisualization index 876fd8f0b74f9e1e86541971bb3d9b6f047f19ff..23bcdfb58df084b6f579c64f5c504c4d108d1e3f 160000 --- a/plugins/TreemapVisualization +++ b/plugins/TreemapVisualization @@ -1 +1 @@ -Subproject commit 876fd8f0b74f9e1e86541971bb3d9b6f047f19ff +Subproject commit 23bcdfb58df084b6f579c64f5c504c4d108d1e3f diff --git a/plugins/VisitorGenerator b/plugins/VisitorGenerator index b2615047a824237433ac55286a12cb2389c9a9e3..924b69d524edea4a326216fe6de7a8df7e9a9ddc 160000 --- a/plugins/VisitorGenerator +++ b/plugins/VisitorGenerator @@ -1 +1 @@ -Subproject commit b2615047a824237433ac55286a12cb2389c9a9e3 +Subproject commit 924b69d524edea4a326216fe6de7a8df7e9a9ddc diff --git a/tests/PHPUnit/Core/Period/RangeTest.php b/tests/PHPUnit/Core/Period/RangeTest.php index 74c350b51bef4962fd3d8745597ef2b67c49f77a..d386ec2b99acad6bb4eb973ba71cbc7a9c2cb54a 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