public function testPreviousLastOfQuarter() { foreach (array('2014-01-01' => '2013-12-31', '2014-01-02' => '2013-12-31', '2014-03-31' => '2014-03-31', '2014-04-01' => '2014-03-31', '2014-06-30' => '2014-06-30', '2014-07-01' => '2014-06-30', '2014-09-30' => '2014-09-30', '2014-10-01' => '2014-09-30', '2014-12-31' => '2014-12-31') as $datum => $expected) { $datum = new Datum($datum); $this->assertEquals(new Datum($expected), $datum->previousLastOfQuarter()); } }