givenThereIsASunObject($rise, $set); $this->assertSame($rise, $this->sun->rise); } public function testSunSet() { $rise = new \DateTime('2014-01-01 08:00:00'); $set = new \DateTime('2014-01-01 20:00:00'); $this->givenThereIsASunObject($rise, $set); $this->assertSame($set, $this->sun->set); } private function givenThereIsASunObject($rise, $set) { $this->sun = new Sun($rise, $set); } /** * @expectedException \LogicException */ public function testSunSetBeforeSunRiseException() { $rise = new \DateTime('2014-01-01 08:00:00'); $set = new \DateTime('2014-01-01 7:00:00'); $this->givenThereIsASunObject($rise, $set); } }