summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php82
1 files changed, 82 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php
new file mode 100644
index 00000000..1570458a
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/includes/dataitems/DIConceptTest.php
@@ -0,0 +1,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' ],
+ ];
+ }
+
+}