Completed
Push — master ( 2a0a89...468a99 )
by Christian
02:41
created

SunTest::givenThereIsASunObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
/**
3
 * Copyright Zikula Foundation 2014 - Zikula Application Framework
4
 *
5
 * This work is contributed to the Zikula Foundation under one or more
6
 * Contributor Agreements and licensed to You under the following license:
7
 *
8
 * @license GNU/LGPv3 (or at your option any later version).
9
 * @package OpenWeatherMap-PHP-Api
10
 *
11
 * Please see the NOTICE file distributed with this source code for further
12
 * information regarding copyright and licensing.
13
 */
14
15
namespace Cmfcmf\OpenWeatherMap\Tests\Util;
16
17
use Cmfcmf\OpenWeatherMap\Util\Sun;
18
19
class SunTest extends \PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * @var Sun
23
     */
24
    private $sun;
25
26 View Code Duplication
    public function testSunRise()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        $rise = new \DateTime('2014-01-01 08:00:00');
29
        $set = new \DateTime('2014-01-01 20:00:00');
30
31
        $this->givenThereIsASunObject($rise, $set);
32
33
        $this->assertSame($rise, $this->sun->rise);
34
    }
35
36 View Code Duplication
    public function testSunSet()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        $rise = new \DateTime('2014-01-01 08:00:00');
39
        $set = new \DateTime('2014-01-01 20:00:00');
40
41
        $this->givenThereIsASunObject($rise, $set);
42
43
        $this->assertSame($set, $this->sun->set);
44
    }
45
46
47
    private function givenThereIsASunObject($rise, $set)
48
    {
49
        $this->sun = new Sun($rise, $set);
50
    }
51
52
    /**
53
     * @expectedException \LogicException
54
     */
55
    public function testSunSetBeforeSunRiseException()
56
    {
57
        $rise = new \DateTime('2014-01-01 08:00:00');
58
        $set = new \DateTime('2014-01-01 7:00:00');
59
60
        $this->givenThereIsASunObject($rise, $set);
61
    }
62
}
63