summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php
blob: 1570458ae65512befd3bb8cba7b02793ab5748ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php

namespace SMW\Tests;

/**
 * @covers \SMW\DIConcept
 *
 * @group SMW
 * @group SMWExtension
 * @group SMWDataItems
 *
 * @license GNU GPL v2+
 * @author mwjames
 */
class DIConceptTest extends DataItemTest {

	/**
	 * Returns the name of the class to be tested
	 *
	 * @since 1.8
	 *
	 * @return string
	 */
	public function getClass() {
		return 'SMW\DIConcept';
	}

	/**
	 * @see DataItemTest::constructorProvider
	 *
	 * @since 1.8
	 *
	 * @return array
	 */
	public function constructorProvider() {
		return [
			[ 'Foo', '', '', '', '' ],
		];
	}

	/**
	 * @test DIConcept::setCacheStatus
	 * @test DIConcept::setCacheDate
	 * @test DIConcept::setCacheCount
	 * @dataProvider conceptCacheDataProvider
	 *
	 * @since 1.9
	 *
	 * @param $status
	 * @param $date
	 * @param $count
	 */
	public function testConceptCacheSetterGetter( $status, $date, $count ) {

		$reflector = new \ReflectionClass( $this->getClass() );
		$instance  = $reflector->newInstanceArgs(  [ 'Foo', '', '', '', '' ] );

		$instance->setCacheStatus( $status );
		$instance->setCacheDate( $date );
		$instance->setCacheCount( $count );

		$this->assertEquals( $status, $instance->getCacheStatus() );
		$this->assertEquals( $date, $instance->getCacheDate() );
		$this->assertEquals( $count, $instance->getCacheCount() );

	}

	/**
	 * Data provider for testing concept cache setter/getter
	 *
	 * @since 1.9
	 *
	 * @return array
	 */
	public function conceptCacheDataProvider() {
		return [
			[ 'empty', '', '' ],
			[ 'full', '1358515326', '1000' ],
		];
	}

}