jenkins-bot has submitted this change and it was merged.
Change subject: enabled parameter "transpose" and added phpunit test.
......................................................................
enabled parameter "transpose" and added phpunit test.
Change-Id: Ibc8ab676cf4bf6534e9e050da9da35d9eebf17ff
---
M includes/queryprinters/TableResultPrinter.php
M tests/phpunit/includes/queryprinters/TableResultPrinterTest.php
2 files changed, 30 insertions(+), 10 deletions(-)
Approvals:
Jeroen De Dauw: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/queryprinters/TableResultPrinter.php
b/includes/queryprinters/TableResultPrinter.php
index 40578c9..5f5de47 100644
--- a/includes/queryprinters/TableResultPrinter.php
+++ b/includes/queryprinters/TableResultPrinter.php
@@ -92,10 +92,7 @@
$tableAttrs['width'] = '100%';
}
- // @note A table is only transposable if header elements are
visible
- // $this->mShowHeaders !== SMW_HEADERS_HIDE &&
$this->params['transpose']
- // if transpose is enabled, please adopt the unit test as well
- return $this->tableFormatter->transpose( false )->getTable(
$tableAttrs );
+ return $this->tableFormatter->transpose( $this->mShowHeaders
!== SMW_HEADERS_HIDE && $this->params['transpose'] )->getTable( $tableAttrs );
}
/**
@@ -209,12 +206,11 @@
'default' => 'sortable wikitable smwtable',
);
- // Uncomment to enable this feature
- // $params['transpose'] = array(
- // 'type' => 'boolean',
- // 'default' => false,
- // 'message' => 'smw-paramdesc-table-transpose',
- // );
+ $params['transpose'] = array(
+ 'type' => 'boolean',
+ 'default' => false,
+ 'message' => 'smw-paramdesc-table-transpose',
+ );
return $params;
}
diff --git a/tests/phpunit/includes/queryprinters/TableResultPrinterTest.php
b/tests/phpunit/includes/queryprinters/TableResultPrinterTest.php
index bc5d54d..42935a6 100644
--- a/tests/phpunit/includes/queryprinters/TableResultPrinterTest.php
+++ b/tests/phpunit/includes/queryprinters/TableResultPrinterTest.php
@@ -282,6 +282,30 @@
)
);
+ // #3 "transpose=true"
+ $parameters = array(
+ 'headers' => SMW_HEADERS_PLAIN,
+ 'class' => 'tableClass',
+ 'format' => 'table',
+ 'offset' => 0,
+ 'transpose' => true
+ );
+
+ //TODO add proper matching data, which I can't seem to get to
work.
+ //MWJames would you mind doing the honors?
+ $matcher = array();
+
+ $provider[] = array(
+ array(
+ 'parameters' => $parameters,
+ 'queryResult' => $queryResult,
+ 'outputMode' => SMW_OUTPUT_FILE
+ ),
+ array(
+ 'matcher' => $matcher
+ )
+ );
+
return $provider;
}
--
To view, visit https://gerrit.wikimedia.org/r/74329
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc8ab676cf4bf6534e9e050da9da35d9eebf17ff
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Netbrain <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: Netbrain <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits