Completed
Pull Request — master (#616)
by Jeroen De
07:08 queued 05:41
created

DateParserTest::testParseDate_Year()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
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
		$timeValue = $this->createMock( \SMWTimeValue::class );
20
21
		$timeValue->expects( $this->any() )
22
			->method( 'getYear' )
23
			->will( $this->returnValue( 2000 ) );
24
25
		$instance = new DateParser();
26
27
		$this->assertSame(
28
			'20000101',
29
			$instance->parseDate( $timeValue, true )
30
		);
31
	}
32
33
	public function testParseDate_Year_Month_Day_Time() {
34
		$timeValue = $this->createMock( \SMWTimeValue::class );
35
36
		$timeValue->expects( $this->any() )
37
			->method( 'getYear' )
38
			->will( $this->returnValue( 2000 ) );
39
40
		$timeValue->expects( $this->any() )
41
			->method( 'getMonth' )
42
			->will( $this->returnValue( 12 ) );
43
44
		$timeValue->expects( $this->any() )
45
			->method( 'getDay' )
46
			->will( $this->returnValue( 12 ) );
47
48
		$timeValue->expects( $this->any() )
49
			->method( 'getTimeString' )
50
			->will( $this->returnValue( '12:01:01' ) );
51
52
		$instance = new DateParser();
53
54
		$this->assertSame(
55
			'20001212T120101',
56
			$instance->parseDate( $timeValue, true )
57
		);
58
	}
59
60
}
61