jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/364391 )

Change subject: UsageTracker: API unittest
......................................................................


UsageTracker: API unittest

Change-Id: I90e582c4773bbaf9a53bf8c94c56413c1759c258
ERM: #6815
---
A UsageTracker/tests/phpunit/UsageTrackerStoreTest.php
1 file changed, 92 insertions(+), 0 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UsageTracker/tests/phpunit/UsageTrackerStoreTest.php 
b/UsageTracker/tests/phpunit/UsageTrackerStoreTest.php
new file mode 100644
index 0000000..6200328
--- /dev/null
+++ b/UsageTracker/tests/phpunit/UsageTrackerStoreTest.php
@@ -0,0 +1,92 @@
+<?php
+
+/**
+ * @group medium
+ * @group Api
+ * @group BlueSpice
+ * @group BlueSpiceExtensions
+ */
+class UsageTrackerStoreTest extends BSApiExtJSStoreTestBase {
+       protected $iFixtureTotal = 3;
+
+       protected function getStoreSchema() {
+               return [
+                       'count' => [
+                               'type' => 'string'
+                       ],
+                       'descriptionKey' => [
+                               'type' => 'string'
+                       ],
+                       'identifier' => [
+                               'type' => 'string'
+                       ],
+                       'type' => [
+                               'type' => 'string'
+                       ],
+                       'description' => [
+                               'type' => 'string'
+                       ],
+                       'updateDate' => [
+                               'type' => 'string'
+                       ]
+               ];
+       }
+
+       protected function createStoreFixtureData() {
+               $aFixtureData = array(
+                       array( 'ut_identifier' => 'dummy', 'ut_count' => 2, 
'ut_type' => 'BS\UsageTracker\Collectors\Property', 'ut_timestamp' => 
wfTimestampNow () ),
+                       array( 'ut_identifier' => 'dummy2', 'ut_count' => 4, 
'ut_type' => 'BS\UsageTracker\Collectors\Property', 'ut_timestamp' => 
wfTimestampNow () ),
+                       array( 'ut_identifier' => 'test', 'ut_count' => 8, 
'ut_type' => 'BS\UsageTracker\Collectors\Property', 'ut_timestamp' => 
wfTimestampNow () )
+               );
+               $oDbw = wfGetDB( DB_MASTER );
+               $oDbw->insert(
+                       'bs_usagetracker',
+                       $aFixtureData,
+                       __METHOD__
+               );
+
+               return 3;
+       }
+
+       protected function getModuleName() {
+               return 'bs-usagetracker-store';
+       }
+
+       public function provideSingleFilterData() {
+               return [
+                       'Filter by identifier' => [ 'string', 'eq', 
'identifier', 'dummy', 1 ],
+                       'Filter by count' => [ 'string', 'eq', 'count', '2', 1 ]
+               ];
+       }
+
+       public function provideMultipleFilterData() {
+               return [
+                       'Filter by identifier and count' => [
+                               [
+                                       [
+                                               'type' => 'string',
+                                               'comparison' => 'ct',
+                                               'field' => 'identifier',
+                                               'value' => 'dummy'
+                                       ],
+                                       [
+                                               'type' => 'string',
+                                               'comparison' => 'eq',
+                                               'field' => 'count',
+                                               'value' => '2'
+                                       ]
+                               ],
+                               1
+                       ]
+               ];
+       }
+
+       public function provideKeyItemData() {
+               return array(
+                       [ 'identifier', 'test' ],
+                       [ 'identifier', 'dummy' ],
+                       [ 'count', '8' ]
+               );
+       }
+}
+

-- 
To view, visit https://gerrit.wikimedia.org/r/364391
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I90e582c4773bbaf9a53bf8c94c56413c1759c258
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_27
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: ItSpiderman <[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

Reply via email to