summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Exporter/ResourceBuilders/AuxiliaryPropertyValueResourceBuilderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Exporter/ResourceBuilders/AuxiliaryPropertyValueResourceBuilderTest.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Exporter/ResourceBuilders/AuxiliaryPropertyValueResourceBuilderTest.php79
1 files changed, 79 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Exporter/ResourceBuilders/AuxiliaryPropertyValueResourceBuilderTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Exporter/ResourceBuilders/AuxiliaryPropertyValueResourceBuilderTest.php
new file mode 100644
index 00000000..45f91d3d
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Exporter/ResourceBuilders/AuxiliaryPropertyValueResourceBuilderTest.php
@@ -0,0 +1,79 @@
+<?php
+
+namespace SMW\Tests\Exporter\ResourceBuilders;
+
+use SMW\DataItemFactory;
+use SMW\Exporter\Element\ExpNsResource;
+use SMW\Exporter\ResourceBuilders\AuxiliaryPropertyValueResourceBuilder;
+use SMW\Tests\TestEnvironment;
+use SMWExpData as ExpData;
+
+/**
+ * @covers \SMW\Exporter\ResourceBuilders\AuxiliaryPropertyValueResourceBuilder
+ * @group semantic-mediawiki
+ *
+ * @license GNU GPL v2+
+ * @since 2.5
+ *
+ * @author mwjames
+ */
+class AuxiliaryPropertyValueResourceBuilderTest extends \PHPUnit_Framework_TestCase {
+
+ private $dataItemFactory;
+ private $testEnvironment;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->dataItemFactory = new DataItemFactory();
+ $this->testEnvironment = new TestEnvironment();
+
+ $this->testEnvironment->resetPoolCacheById( \SMWExporter::POOLCACHE_ID );
+ }
+
+ protected function tearDown() {
+ $this->testEnvironment->tearDown();
+ parent::tearDown();
+ }
+
+ public function testCanConstruct() {
+
+ $this->assertInstanceof(
+ AuxiliaryPropertyValueResourceBuilder::class,
+ new AuxiliaryPropertyValueResourceBuilder()
+ );
+ }
+
+ public function testIsNotResourceBuilderForNonImpoProperty() {
+
+ $property = $this->dataItemFactory->newDIProperty( 'Foo' );
+
+ $instance = new AuxiliaryPropertyValueResourceBuilder();
+
+ $this->assertFalse(
+ $instance->isResourceBuilderFor( $property )
+ );
+ }
+
+ public function testAddResourceValueForSelectedAuxiliaryProperty() {
+
+ $property = $this->dataItemFactory->newDIProperty( '_dat' );
+ $dataItem = $this->dataItemFactory->newDIWikiPage( 'Foo', NS_MAIN );
+
+ $expData = new ExpData(
+ new ExpNsResource( 'Foobar', 'Bar', 'Mo', null )
+ );
+
+ $instance = new AuxiliaryPropertyValueResourceBuilder();
+
+ $instance->addResourceValue(
+ $expData,
+ $property,
+ $dataItem
+ );
+
+ $this->assertTrue(
+ $instance->isResourceBuilderFor( $property )
+ );
+ }
+
+}