3 * Copyright Zikula Foundation 2014 - Zikula Application Framework
5 * This work is contributed to the Zikula Foundation under one or more
6 * Contributor Agreements and licensed to You under the following license:
8 * @license GNU/LGPv3 (or at your option any later version).
9 * @package OpenWeatherMap-PHP-Api
11 * Please see the NOTICE file distributed with this source code for further
12 * information regarding copyright and licensing.
15 namespace Cmfcmf\OpenWeatherMap\Tests\Util;
17 use Cmfcmf\OpenWeatherMap\Util\Sun;
19 class SunTest extends \PHPUnit_Framework_TestCase
26 public function testSunRise()
28 $rise = new \DateTime('2014-01-01 08:00:00');
29 $set = new \DateTime('2014-01-01 20:00:00');
31 $this->givenThereIsASunObject($rise, $set);
33 $this->assertSame($rise, $this->sun->rise);
36 public function testSunSet()
38 $rise = new \DateTime('2014-01-01 08:00:00');
39 $set = new \DateTime('2014-01-01 20:00:00');
41 $this->givenThereIsASunObject($rise, $set);
43 $this->assertSame($set, $this->sun->set);
47 private function givenThereIsASunObject($rise, $set)
49 $this->sun = new Sun($rise, $set);
53 * @expectedException \LogicException
55 public function testSunSetBeforeSunRiseException()
57 $rise = new \DateTime('2014-01-01 08:00:00');
58 $set = new \DateTime('2014-01-01 7:00:00');
60 $this->givenThereIsASunObject($rise, $set);