[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceExtensions[master]: PageTemplates: API Unittest

2017-03-24 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/344401 )

Change subject: PageTemplates: API Unittest
..


PageTemplates: API Unittest

Change-Id: I1d1e9f28e0b70945ed67fa4b226c3a717b98dda2
ERM: #5808
---
A PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php
A PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php
2 files changed, 168 insertions(+), 0 deletions(-)

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



diff --git a/PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php 
b/PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php
new file mode 100644
index 000..7d55d69
--- /dev/null
+++ b/PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php
@@ -0,0 +1,73 @@
+ [
+   'type' => 'integer'
+   ],
+   'label' => [
+   'type' => 'string'
+   ],
+   'desc' => [
+   'type' => 'string'
+   ],
+   'targetns' => [
+   'type' => 'string'
+   ],
+   'targetnsid' => [
+   'type' => 'integer'
+   ],
+   'template' => [
+   'type' => 'string'
+   ],
+   'templatename' => [
+   'type' => 'string'
+   ]
+   ];
+   }
+
+   protected function createStoreFixtureData() {
+   new BSPageTemplateFixtures();
+   return 8;
+   }
+
+   protected function getModuleName () {
+   return 'bs-pagetemplates-store';
+   }
+
+   public function provideSingleFilterData () {
+   return [
+   'Filter by label' => [ 'string', 'eq', 'label', 'Test 
01', 1]
+   ];
+   }
+
+   public function provideMultipleFilterData() {
+   return [
+   'Filter by targetnsid and templatename' => [
+   [
+   [
+   'type' => 'integer',
+   'comparison' => 'eq',
+   'field' => 'targetnsid',
+   'value' => NS_FILE
+   ],
+   [
+   'type' => 'string',
+   'comparison' => 'ct',
+   'field' => 'label',
+   'value' => '01'
+   ]
+   ],
+   1
+   ]
+   ];
+   }
+}
+
diff --git a/PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php 
b/PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php
new file mode 100644
index 000..6720a14
--- /dev/null
+++ b/PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php
@@ -0,0 +1,95 @@
+getTokenList( self::$users[ 'sysop' ] );
+   }
+
+   public function testDoEditTemplate() {
+   //add template
+   $oData = $this->executeTask(
+   'doEditTemplate',
+   array(
+   'desc' => 'Dummy template',
+   'label' => 'Dummy 1',
+   'template' => 'Dummy 1 title',
+   'targetns' => NS_FILE
+   )
+   );
+
+   $this->assertTrue( $oData->success );
+
+   $this->assertSelect(
+   'bs_pagetemplate',
+   array( 'pt_id', 'pt_template_title', 
'pt_target_namespace'  ),
+   array( "pt_label = 'Dummy 1'" ),
+   array(  array( 9, 'Dummy 1 title', 6 )  )
+   );
+
+   $iIDAdded = 9;
+
+   //edit template
+   $oData = $this->executeTask(
+   'doEditTemplate',
+   array(
+   'id' => $iIDAdded,
+   'desc' => 'Faux template',
+   'label' => 'Faux 1',
+   'template' => 'Faux 1 title',
+   'targetns' => NS_MAIN
+   )
+   );
+
+   $this->assertTrue( $oData->success );
+
+   $this->assertSelect(
+   'bs_pagetemplate',
+   array( 

[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceExtensions[master]: PageTemplates: API Unittest

2017-03-23 Thread ItSpiderman (Code Review)
ItSpiderman has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344401 )

Change subject: PageTemplates: API Unittest
..

PageTemplates: API Unittest

Change-Id: I1d1e9f28e0b70945ed67fa4b226c3a717b98dda2
ERM: #5808
---
A PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php
A PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php
2 files changed, 168 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/01/344401/1

diff --git a/PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php 
b/PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php
new file mode 100644
index 000..7d55d69
--- /dev/null
+++ b/PageTemplates/tests/phpunit/BSApiPageTemplatesStoreTest.php
@@ -0,0 +1,73 @@
+ [
+   'type' => 'integer'
+   ],
+   'label' => [
+   'type' => 'string'
+   ],
+   'desc' => [
+   'type' => 'string'
+   ],
+   'targetns' => [
+   'type' => 'string'
+   ],
+   'targetnsid' => [
+   'type' => 'integer'
+   ],
+   'template' => [
+   'type' => 'string'
+   ],
+   'templatename' => [
+   'type' => 'string'
+   ]
+   ];
+   }
+
+   protected function createStoreFixtureData() {
+   new BSPageTemplateFixtures();
+   return 8;
+   }
+
+   protected function getModuleName () {
+   return 'bs-pagetemplates-store';
+   }
+
+   public function provideSingleFilterData () {
+   return [
+   'Filter by label' => [ 'string', 'eq', 'label', 'Test 
01', 1]
+   ];
+   }
+
+   public function provideMultipleFilterData() {
+   return [
+   'Filter by targetnsid and templatename' => [
+   [
+   [
+   'type' => 'integer',
+   'comparison' => 'eq',
+   'field' => 'targetnsid',
+   'value' => NS_FILE
+   ],
+   [
+   'type' => 'string',
+   'comparison' => 'ct',
+   'field' => 'label',
+   'value' => '01'
+   ]
+   ],
+   1
+   ]
+   ];
+   }
+}
+
diff --git a/PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php 
b/PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php
new file mode 100644
index 000..6720a14
--- /dev/null
+++ b/PageTemplates/tests/phpunit/BSApiPageTemplatesTasksTest.php
@@ -0,0 +1,95 @@
+getTokenList( self::$users[ 'sysop' ] );
+   }
+
+   public function testDoEditTemplate() {
+   //add template
+   $oData = $this->executeTask(
+   'doEditTemplate',
+   array(
+   'desc' => 'Dummy template',
+   'label' => 'Dummy 1',
+   'template' => 'Dummy 1 title',
+   'targetns' => NS_FILE
+   )
+   );
+
+   $this->assertTrue( $oData->success );
+
+   $this->assertSelect(
+   'bs_pagetemplate',
+   array( 'pt_id', 'pt_template_title', 
'pt_target_namespace'  ),
+   array( "pt_label = 'Dummy 1'" ),
+   array(  array( 9, 'Dummy 1 title', 6 )  )
+   );
+
+   $iIDAdded = 9;
+
+   //edit template
+   $oData = $this->executeTask(
+   'doEditTemplate',
+   array(
+   'id' => $iIDAdded,
+   'desc' => 'Faux template',
+   'label' => 'Faux 1',
+   'template' => 'Faux 1 title',
+   'targetns' => NS_MAIN
+   )
+   );
+
+   $this->assertTrue( $oData->success );
+
+   $this->assertSelect(
+   'bs_pagetemplate',
+