Mwjames has uploaded a new change for review.
https://gerrit.wikimedia.org/r/93921
Change subject: (Bug 56643) Special:ExportRDF $lexicalForm needs to be a string
......................................................................
(Bug 56643) Special:ExportRDF $lexicalForm needs to be a string
$dataItem->getNumber() needs to be converted into a string
Change-Id: I3c35d66447638b36bbb45db9fca2bec5436e989a
---
M includes/export/SMW_Exporter.php
A tests/phpunit/includes/export/SMWExporterTest.php
2 files changed, 60 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki
refs/changes/21/93921/1
diff --git a/includes/export/SMW_Exporter.php b/includes/export/SMW_Exporter.php
index fc366cd..f169853 100644
--- a/includes/export/SMW_Exporter.php
+++ b/includes/export/SMW_Exporter.php
@@ -557,7 +557,7 @@
static public function getDataItemExpElement( SMWDataItem $dataItem ) {
switch ( $dataItem->getDIType() ) {
case SMWDataItem::TYPE_NUMBER:
- $lit = new SMWExpLiteral(
$dataItem->getNumber(), 'http://www.w3.org/2001/XMLSchema#double', $dataItem );
+ $lit = new SMWExpLiteral( strval(
$dataItem->getNumber() ), 'http://www.w3.org/2001/XMLSchema#double', $dataItem
);
return $lit;
case SMWDataItem::TYPE_BLOB:
$lit = new SMWExpLiteral( smwfHTMLtoUTF8(
$dataItem->getString() ), 'http://www.w3.org/2001/XMLSchema#string', $dataItem
);
diff --git a/tests/phpunit/includes/export/SMWExporterTest.php
b/tests/phpunit/includes/export/SMWExporterTest.php
new file mode 100644
index 0000000..40a3219
--- /dev/null
+++ b/tests/phpunit/includes/export/SMWExporterTest.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace SMW\Test;
+
+/**
+ * @covers \SMWExporter
+ *
+ * @ingroup Test
+ *
+ * @group SMW
+ * @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author Jeroen De Dauw < [email protected] >
+ */
+class SMWExporterTest extends CompatibilityTestCase {
+
+ /**
+ * @return string|false
+ */
+ public function getClass() {
+ return '\SMWExporter';
+ }
+
+ /**
+ * @dataProvider dataItemExpElementProvider
+ *
+ * @since 1.9
+ */
+ public function testGetDataItemExpElement( \SMWDataItem $dataItem,
$instance ) {
+
+ if ( $instance !== null ) {
+ $this->assertInstanceOf( $instance,
\SMWExporter::getDataItemExpElement( $dataItem ) );
+ }
+
+ $this->assertTrue( true );
+ }
+
+ /**
+ * @since return
+ */
+ public function dataItemExpElementProvider() {
+
+ $provider = array();
+
+ // #0 (bug 56643)
+ $provider[] = array( new \SMWDINumber( 9001 ), 'SMWExpElement'
);
+
+ $provider[] = array( new \SMWDIBlob( 'foo' ), 'SMWExpElement'
);
+ $provider[] = array( new \SMWDIBoolean( true ), 'SMWExpElement'
);
+
+ $provider[] = array( new \SMWDIConcept( 'Foo', '', '', '', ''
), null );
+
+ return $provider;
+ }
+
+}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/93921
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c35d66447638b36bbb45db9fca2bec5436e989a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits