Ljonka has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/350816 )
Change subject: [WIP] Avatars: add phpunit base tests
......................................................................
[WIP] Avatars: add phpunit base tests
Change-Id: Ib705418da98dce7f854bc157781031cdae4a446d
---
M Avatars/Avatars.class.php
M Avatars/extension.json
A Avatars/tests/phpunit/BSApiAvatarsTasksTest.php
3 files changed, 112 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/16/350816/1
diff --git a/Avatars/Avatars.class.php b/Avatars/Avatars.class.php
index 6c1a59a..e5df445 100644
--- a/Avatars/Avatars.class.php
+++ b/Avatars/Avatars.class.php
@@ -240,4 +240,16 @@
return $sNewUserImageSrc;
}
+ /**
+ * 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;
+ }
+
}
diff --git a/Avatars/extension.json b/Avatars/extension.json
index 03da66d..c1b988d 100644
--- a/Avatars/extension.json
+++ b/Avatars/extension.json
@@ -50,7 +50,8 @@
"remoteExtPath": "BlueSpiceExtensions/Avatars/resources"
},
"Hooks": {
- "BeforePageDisplay": "Avatars::onBeforePageDisplay"
+ "BeforePageDisplay": "Avatars::onBeforePageDisplay",
+ "UnitTestsList": "Avatars::onUnitTestsList"
},
"manifest_version": 1
}
diff --git a/Avatars/tests/phpunit/BSApiAvatarsTasksTest.php
b/Avatars/tests/phpunit/BSApiAvatarsTasksTest.php
new file mode 100644
index 0000000..b96fb41
--- /dev/null
+++ b/Avatars/tests/phpunit/BSApiAvatarsTasksTest.php
@@ -0,0 +1,98 @@
+<?php
+
+/*
+ * Test BlueSpiceAvatars API Endpoints
+ */
+
+/**
+ * @group BlueSpiceAvatars
+ * @group BlueSpice
+ * @group API
+ * @group Database
+ * @group medium
+ */
+
+class BSApiAvatarsTasksTest extends BSApiTasksTestBase {
+
+ protected function getModuleName() {
+ return "bs-avatars-tasks";
+ }
+
+ /**
+ * 'generateAvatar' => [
+ 'examples' => [],
+ 'params' => []
+ ],
+ * @return type
+ */
+ function testGenerateAvatar() {
+ $data = $this->executeTask(
+ 'generateAvatar', [
+ 'portletConfig' => [ json_encode( [ ] ) ]
+ ]
+ );
+
+ $this->assertEquals( true, $data->success );
+
+ return $data;
+ }
+
+ /**
+ * 'setUserImage' => [
+ 'examples' => [
+ [
+ 'userImage' => 'ProfileImage.png'
+ ]
+ ],
+ 'params' => [
+ 'userImage' => [
+ 'desc' => 'Name of the image to set',
+ 'type' => 'string',
+ 'required' => true
+ ]
+ ]
+ ]
+ * @return type
+ */
+ function testSetUserImage() {
+ $data = $this->executeTask(
+ 'setUserImage', [
+ 'portletConfig' => [ json_encode( [ "userimage" =>
"TestImage.png"] ) ]
+ ]
+ );
+
+ $this->assertEquals( true, $data->success );
+
+ return $data;
+ }
+
+ /**
+ *
+ * 'uploadFile' => [
+ 'examples' => [],
+ 'params' => []
+ ],
+ *
+ * @return type
+ */
+ function testUploadFile() {
+ //upload a file to tmp
+
+ //set post params
+
+ //call task
+ $data = $this->executeTask(
+ 'uploadFile', [
+ 'portletConfig' => [ json_encode( [ ] ) ]
+ ]
+ );
+
+
+ print_r($data);
+
+ $this->assertEquals( true, $data->success );
+
+ return $data;
+ }
+
+}
--
To view, visit https://gerrit.wikimedia.org/r/350816
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib705418da98dce7f854bc157781031cdae4a446d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Ljonka <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits