gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php

82 lines
1.5 KiB
PHP

<?php
namespace SMW\Tests;
/**
* @covers \SMW\DIConcept
*
* @group SMW
* @group SMWExtension
* @group SMWDataItems
* @group Database
*
* @license GPL-2.0-or-later
* @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' ],
];
}
}