jenkins-bot has submitted this change and it was merged.

Change subject: fix __construc method in Slick class (v 1.1.0) incompatible 
changes!!!
......................................................................


fix __construc method in Slick class (v 1.1.0) incompatible changes!!!

I reordered the parameters in the constructor method since version 1.1.0,
because this sequence will be better for all future widgets.

Change-Id: Ia6d08104581744f3ea4114d322628df9f47bdd5f
---
M PhpTagsWidgets.php
M includes/WidgetSlick.php
M tests/phpunit/Slick_Test.php
3 files changed, 21 insertions(+), 9 deletions(-)

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



diff --git a/PhpTagsWidgets.php b/PhpTagsWidgets.php
index 7771cbd..156a827 100644
--- a/PhpTagsWidgets.php
+++ b/PhpTagsWidgets.php
@@ -33,7 +33,7 @@
        );
 }
 
-define( 'PHPTAGS_WIDGETS_VERSION' , '1.0.0' );
+define( 'PHPTAGS_WIDGETS_VERSION' , '1.1.0' );
 
 // Register this extension on Special:Version
 $wgExtensionCredits['phptags'][] = array(
@@ -71,7 +71,7 @@
        return true;
 };
 
-$wgParserTestFiles[] = __DIR__ . '/tests/parser/PhpTagsWidgetsTests.txt';
+// @todo $wgParserTestFiles[] = __DIR__ . 
'/tests/parser/PhpTagsWidgetsTests.txt';
 
 $tpl = array(
        'localBasePath' => __DIR__ . '/resources',
diff --git a/includes/WidgetSlick.php b/includes/WidgetSlick.php
index adc25fd..ab6d5be 100644
--- a/includes/WidgetSlick.php
+++ b/includes/WidgetSlick.php
@@ -9,7 +9,6 @@
  */
 class WidgetSlick extends \PhpTags\GenericWidget {
 
-       protected static $modules = false;
        protected static $trueCase = array(
                'adaptiveheight' => 'adaptiveHeight',
                'autoplayspeed' => 'autoplaySpeed',
@@ -29,7 +28,7 @@
                'variablewidth' => 'variableWidth',
        );
 
-       public function m___construct( $properties = null, $value = null ) {
+       public function m___construct( $value = null, $properties = null ) {
                $this->value[self::DATA] = $value;
                return parent::m___construct( $properties );
        }
@@ -51,6 +50,19 @@
                        $data = '<div>' . implode( '</div><div>', 
$this->value[self::DATA] ) . '</div>';
                }
                return $data;
+       }
+
+       public static function checkArguments( $object, $method, $arguments, 
$expects = false ) {
+               switch ( $method ) {
+                       case '__construct':
+                               $expects = array(
+                                       \PhpTags\Hooks::TYPE_MIXED,
+                                       \PhpTags\Hooks::TYPE_ARRAY,
+                                       
\PhpTags\Hooks::EXPECTS_MAXIMUM_PARAMETERS => 2,
+                               );
+                               break;
+               }
+               return parent::checkArguments( $object, $method, $arguments, 
$expects );
        }
 
        private function checkProperty( $property, &$value ) {
@@ -94,7 +106,7 @@
                        case 'cssEase':
 // @???todo case 'customPaging': ???
 // @todo       case 'easing':
-//                     case 'lazyLoad':
+//                     case 'lazyLoad': // do not allow it!!!
                        case 'slide':
                                $expects = \PhpTags\Hooks::TYPE_STRING;
                                break;
diff --git a/tests/phpunit/Slick_Test.php b/tests/phpunit/Slick_Test.php
index cbab1f9..7fbbb81 100644
--- a/tests/phpunit/Slick_Test.php
+++ b/tests/phpunit/Slick_Test.php
@@ -5,27 +5,27 @@
 
        public function testRun_property_style() {
                $this->assertEquals(
-                               Runtime::runSource( '$s = new Slick( 
["sTyLe"=>"myStyle"] ); echo $s->StYlE;' ),
+                               Runtime::runSource( '$s = new Slick( null, 
["sTyLe"=>"myStyle"] ); echo $s->StYlE;' ),
                                array( 'myStyle' )
                        );
        }
 
        public function testRun_property_unset_1() {
                $this->assertEquals(
-                               Runtime::runSource( '$s = new Slick( 
["style"=>"myStyle"] ); echo $s->style; $s->sTyle = null; echo $s->style;' ),
+                               Runtime::runSource( '$s = new Slick( null, 
["style"=>"myStyle"] ); echo $s->style; $s->sTyle = null; echo $s->style;' ),
                                array( 'myStyle', null )
                        );
        }
        public function testRun_property_unset_2() {
                $this->assertEquals(
-                               Runtime::runSource( '$s = new Slick( 
["dotS"=>"it must be boolean true"] ); echo $s->dOts; $s->Dots = null; echo 
$s->doTs;' ),
+                               Runtime::runSource( '$s = new Slick( null, 
["dotS"=>"it must be boolean true"] ); echo $s->dOts; $s->Dots = null; echo 
$s->doTs;' ),
                                array( true, null )
                        );
        }
 
        public function testRun_property_rtl() {
                $this->assertEquals(
-                               Runtime::runSource( '$s = new Slick( 
["rTl"=>"it must be boolean true"] ); echo $s->RtL, $s->diR;' ),
+                               Runtime::runSource( '$s = new Slick( null, 
["rTl"=>"it must be boolean true"] ); echo $s->RtL, $s->diR;' ),
                                array( true, 'rtl' )
                        );
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6d08104581744f3ea4114d322628df9f47bdd5f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/PhpTagsWidgets
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to