ItSpiderman has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/357976 )

Change subject: API unittest: BSApiCategoryStore
......................................................................

API unittest: BSApiCategoryStore

Change-Id: I792c25ac3d326df62fc3eb829b105c411c4c0cfb
ERM: #6553
---
A tests/api/BSApiCategoryStoreTest.php
1 file changed, 96 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/76/357976/1

diff --git a/tests/api/BSApiCategoryStoreTest.php 
b/tests/api/BSApiCategoryStoreTest.php
new file mode 100644
index 0000000..baebda4
--- /dev/null
+++ b/tests/api/BSApiCategoryStoreTest.php
@@ -0,0 +1,96 @@
+<?php
+
+/**
+ * @group medium
+ * @group api
+ * @group BlueSpice
+ * @group BlueSpiceFoundation
+ */
+class BSApiCategoryStoreTest extends BSApiExtJSStoreTestBase {
+       protected $iFixtureTotal = 2;
+
+       protected function getStoreSchema() {
+               return [
+                       'cat_id' => [
+                               'type' => 'integer'
+                       ],
+                       'cat_title' => [
+                               'type' => 'string'
+                       ],
+                       'text' => [
+                               'type' => 'string'
+                       ],
+                       'cat_pages' => [
+                               'type' => 'integer'
+                       ],
+                       'cat_subcats' => [
+                               'type' => 'integer'
+                       ],
+                       'cat_files' => [
+                               'type' => 'integer'
+                       ],
+                       'prefixed_text' => [
+                               'type' => 'sting'
+                       ]
+               ];
+       }
+
+       protected function createStoreFixtureData() {
+               $oDbw = wfGetDB( DB_MASTER );
+               $oDbw->insert( 'category', array(
+                       'cat_title' => "Dummy test",
+                       'cat_pages' => 3,
+                       'cat_files' => 1
+               ) );
+
+               $oDbw->insert( 'category', array(
+                       'cat_title' => "Dummy test 2",
+                       'cat_pages' => 2,
+                       'cat_files' => 3
+               ) );
+
+               $oDbw->insert( 'categorylinks', array(
+                       'cl_to' => "Dummy test"
+               ) );
+
+               $oDbw->insert( 'page', array(
+                       'page_title' => "Dummy test 2",
+                       'page_namespace' => NS_CATEGORY
+               ) );
+
+               return 2;
+       }
+
+       protected function getModuleName() {
+               return 'bs-category-store';
+       }
+
+       public function provideSingleFilterData() {
+               return [
+                       'Filter by cat_title' => [ 'string', 'ct', 'cat_title', 
'test', 2 ]
+               ];
+       }
+
+       public function provideMultipleFilterData() {
+               return [
+                       'Filter by cat_pages and cat_title' => [
+                               [
+                                       [
+                                               'type' => 'numeric',
+                                               'comparison' => 'eq',
+                                               'field' => 'cat_pages',
+                                               'value' => 3
+                                       ],
+                                       [
+                                               'type' => 'string',
+                                               'comparison' => 'ct',
+                                               'field' => 'cat_title',
+                                               'value' => 'test'
+                                       ]
+                               ],
+                               1
+                       ]
+               ];
+       }
+}
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I792c25ac3d326df62fc3eb829b105c411c4c0cfb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <d.savulje...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to