Completed
Push — fup-308 ( a0b32f )
by mw
18:26
created

IcalTimezoneFormatterTest::testCanConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace SRF\Tests\iCalendar;
4
5
use SRF\iCalendar\IcalTimezoneFormatter;
6
7
/**
8
 * @covers \SRF\iCalendar\IcalTimezoneFormatter
9
 * @group semantic-result-formats
10
 *
11
 * @license GNU GPL v2+
12
 * @since 3.0
13
 *
14
 * @author mwjames
15
 */
16
class IcalTimezoneFormatterTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testCanConstruct() {
19
20
		$this->assertInstanceOf(
21
			IcalTimezoneFormatter::class,
22
			new IcalTimezoneFormatter()
23
		);
24
	}
25
26
	/**
27
	 * @dataProvider transitionsProvider
28
	 */
29
	public function testGetTransitions( $tz, $from, $to, $expected ) {
30
31
		$instance = new IcalTimezoneFormatter();
32
		$instance->setLocalTimezones( $tz );
33
		$instance->calcTransitions(  $from, $to );
34
35
		$this->assertSame(
36
			$expected,
37
			$instance->getTransitions()
38
		);
39
	}
40
41
	public function transitionsProvider() {
42
43
		yield [
44
			'UTC',
45
			1,
46
			2,
47
			"BEGIN:VTIMEZONE\r\nTZID:UTC\r\nBEGIN:STANDARD\r\nDTSTART:19011213T204552\r\nTZOFFSETFROM:+0000\r\nTZOFFSETTO:+0000\r\nTZNAME:UTC\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\n"
48
		];
49
	}
50
51
}
52