Completed
Push — master ( ba7c5d...c3b626 )
by Julián
02:08
created

AbstractScheduledTest::setUp()   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 0
1
<?php
2
/**
3
 * Effortless maintenance management (http://juliangut.com/janitor)
4
 *
5
 * @link https://github.com/juliangut/janitor for the canonical source repository
6
 *
7
 * @license https://github.com/juliangut/janitor/blob/master/LICENSE
8
 */
9
10
namespace Janitor\Test\Watcher\Scheduled;
11
12
use Janitor\Watcher\Scheduled\Fixed;
13
14
/**
15
 * @covers \Janitor\Watcher\Scheduled\Fixed
16
 */
17
class AbstractScheduledTest extends \PHPUnit_Framework_TestCase
18
{
19
    protected $watcher;
20
21
    public function setUp()
22
    {
23
        $this->watcher = new Fixed('yesterday', 'tomorrow');
24
    }
25
26
    /**
27
     * @covers \Janitor\Watcher\Scheduled\AbstractScheduled::setTimeZone
28
     *
29
     * @expectedException \InvalidArgumentException
30
     */
31
    public function testBadTimeZone()
32
    {
33
        $this->watcher->setTimeZone('unknown');
34
    }
35
36
    /**
37
     * @covers \Janitor\Watcher\Scheduled\AbstractScheduled::setTimeZone
38
     * @covers \Janitor\Watcher\Scheduled\AbstractScheduled::getTimeZone
39
     */
40
    public function testTimeZone()
41
    {
42
        $this->assertEquals(
43
            (new \DateTimeZone(date_default_timezone_get()))->getName(),
44
            $this->watcher->getTimeZone()->getName()
45
        );
46
47
        $this->watcher->setTimeZone('Europe/Madrid');
48
        $this->assertEquals('Europe/Madrid', $this->watcher->getTimeZone()->getName());
49
    }
50
}
51