jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/342196 )
Change subject: API Unittest: InsertMagic
......................................................................
API Unittest: InsertMagic
When $iFixtureTotal is set from createStoreFixtureData() for some reason
its value is not accessible from all test* functions. Only thing that
works is setting it the test class itself.
Since this API requests returns plenty of data and data return is not
predictable due to hooks, for filtering I just used one single and one
multiple filter, just to make sure filtering does work.
Change-Id: I80ccc865ff31c6a66a9c6b7d7d2a5f350c97b44f
ERM: #5804
---
M InsertMagic/InsertMagic.class.php
M InsertMagic/extension.json
A InsertMagic/tests/phpunit/BSApiInsertMagicDataStoreTest.php
3 files changed, 80 insertions(+), 0 deletions(-)
Approvals:
Robert Vogel: Looks good to me, approved
jenkins-bot: Verified
diff --git a/InsertMagic/InsertMagic.class.php
b/InsertMagic/InsertMagic.class.php
index 14618dd..7282688 100644
--- a/InsertMagic/InsertMagic.class.php
+++ b/InsertMagic/InsertMagic.class.php
@@ -150,4 +150,16 @@
array_splice( $aConfigOverwrite["toolbar2"], $iIndexOverwrite +
1, 0, "bsmagic" );
return true;
}
+
+ /**
+ * UnitTestsList allows registration of additional test suites to
execute
+ * under PHPUnit. Extensions can append paths to files to the $paths
array,
+ * and since MediaWiki 1.24, can specify paths to directories, which
will
+ * be scanned recursively for any test case files with the suffix
"Test.php".
+ * @param array $paths
+ */
+ public static function onUnitTestsList ( array &$paths ) {
+ $paths[] = __DIR__ . '/tests/phpunit/';
+ return true;
+ }
}
\ No newline at end of file
diff --git a/InsertMagic/extension.json b/InsertMagic/extension.json
index d1347af..5581f42 100644
--- a/InsertMagic/extension.json
+++ b/InsertMagic/extension.json
@@ -23,6 +23,9 @@
"i18n"
]
},
+ "Hooks": {
+ "UnitTestsList":"InsertMagic::onUnitTestsList"
+ },
"AutoloadClasses": {
"InsertMagic": "InsertMagic.class.php",
"BSApiInsertMagicDataStore":
"includes/api/BSApiInsertMagicDataStore.php"
diff --git a/InsertMagic/tests/phpunit/BSApiInsertMagicDataStoreTest.php
b/InsertMagic/tests/phpunit/BSApiInsertMagicDataStoreTest.php
new file mode 100644
index 0000000..2305adc
--- /dev/null
+++ b/InsertMagic/tests/phpunit/BSApiInsertMagicDataStoreTest.php
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * @group medium
+ */
+class BSApiInsertMagicDataStoreTest extends BSApiExtJSStoreTestBase {
+
+ protected $iFixtureTotal = 72;
+
+ protected function getStoreSchema() {
+ return [
+ 'id' => [
+ 'type' => 'string'
+ ],
+ 'type' => [
+ 'type' => 'string'
+ ],
+ 'name' => [
+ 'type' => 'string'
+ ],
+ 'desc' => [
+ 'type' => 'string'
+ ],
+ 'code' => [
+ 'type' => 'string'
+ ]
+ ];
+ }
+
+ protected function createStoreFixtureData() {
+ return 72;
+ }
+
+ protected function getModuleName() {
+ return 'bs-insertmagic-data-store';
+ }
+
+ public function provideSingleFilterData() {
+ return [
+ 'Filter by name' => [ 'string', 'eq', 'name', 'NOTOC',
1 ]
+ ];
+ }
+
+ public function provideMultipleFilterData() {
+ return [
+ 'Filter by name and type' => [
+ [
+ [
+ 'type' => 'string',
+ 'comparison' => 'eq',
+ 'field' => 'type',
+ 'value' => 'switch'
+ ],
+ [
+ 'type' => 'string',
+ 'comparison' => 'eq',
+ 'field' => 'name',
+ 'value' => 'NOTOC'
+ ]
+ ],
+ 1
+ ]
+ ];
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/342196
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I80ccc865ff31c6a66a9c6b7d7d2a5f350c97b44f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits