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

IcalTimezoneFormatterTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanConstruct() 0 7 1
A testGetTransitions() 0 11 1
A transitionsProvider() 0 9 1
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