Completed
Push — master ( e4957f...670487 )
by
unknown
07:52
created

DateParserTest::testCanConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SRF\Tests\iCalendar;
4
5
use SRF\iCalendar\DateParser;
6
7
/**
8
 * @covers \SRF\iCalendar\DateParser
9
 * @group semantic-result-formats
10
 *
11
 * @license GNU GPL v2+
12
 * @since 3.2
13
 *
14
 * @author mwjames
15
 */
16
class DateParserTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testParseDate_Year() {
19
20
		$timeValue = $this->createMock( \SMWTimeValue::class );
21
22
		$timeValue->expects( $this->any() )
23
			->method( 'getYear' )
24
			->will( $this->returnValue( 2000 ) );
25
26
		$instance = new DateParser();
27
28
		$this->assertSame(
29
			'20000101',
30
			$instance->parseDate( $timeValue, true )
31
		);
32
	}
33
34
	public function testParseDate_Year_Month_Day_Time() {
35
36
		$timeValue = $this->createMock( \SMWTimeValue::class );
37
38
		$timeValue->expects( $this->any() )
39
			->method( 'getYear' )
40
			->will( $this->returnValue( 2000 ) );
41
42
		$timeValue->expects( $this->any() )
43
			->method( 'getMonth' )
44
			->will( $this->returnValue( 12 ) );
45
46
		$timeValue->expects( $this->any() )
47
			->method( 'getDay' )
48
			->will( $this->returnValue( 12 ) );
49
50
		$timeValue->expects( $this->any() )
51
			->method( 'getTimeString' )
52
			->will( $this->returnValue( '12:01:01' ) );
53
54
		$instance = new DateParser();
55
56
		$this->assertSame(
57
			'20001212T120101',
58
			$instance->parseDate( $timeValue, true )
59
		);
60
	}
61
62
}
63