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

Change subject: Accept any JsonSchema >= 1.0 (+ fix tests)
......................................................................

Accept any JsonSchema >= 1.0 (+ fix tests)

MW changes the JsonSchema version so often that it is pointless to
release a new Lingo version every time just to keep up.

* just accept any JsonSchema version >= 1.0
* instead add a test that class \JsonSchema\Validator wit method 'check' exists
* (+ fix tests for PHP 7)

Change-Id: I011232bacffc46d18233befcbc26cfc8a1b0257e
---
M composer.json
M src/Lingo.php
M src/LingoParser.php
M tests/phpunit/Unit/BackendTest.php
M tests/phpunit/Unit/BasicBackendTest.php
M tests/phpunit/Unit/LingoI18NTest.php
6 files changed, 11 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lingo 
refs/changes/15/351715/1

diff --git a/composer.json b/composer.json
index b654c59..7abe331 100644
--- a/composer.json
+++ b/composer.json
@@ -28,11 +28,11 @@
        "require"    : {
                "php"    : ">=5.3.2",
                "ext-dom": "*",
-               "composer/installers": ">1.0.12",
-               "justinrainbow/json-schema": "~3.0"
+               "composer/installers": ">1.0.12"
        },
        "require-dev": {
-               "jakub-onderka/php-parallel-lint": "0.9.2"
+               "jakub-onderka/php-parallel-lint": "0.9.2",
+               "justinrainbow/json-schema": ">=1.0"
        },
        "scripts": {
                "test": [
diff --git a/src/Lingo.php b/src/Lingo.php
index 55fe7cf..ec2df36 100644
--- a/src/Lingo.php
+++ b/src/Lingo.php
@@ -25,7 +25,6 @@
  */
 
 namespace Lingo;
-use MagicWord;
 
 /**
  * Class Lingo
diff --git a/src/LingoParser.php b/src/LingoParser.php
index 5de6d42..f488162 100644
--- a/src/LingoParser.php
+++ b/src/LingoParser.php
@@ -28,7 +28,6 @@
  */
 namespace Lingo;
 
-use DOMDocument;
 use DOMXPath;
 use Parser;
 
diff --git a/tests/phpunit/Unit/BackendTest.php 
b/tests/phpunit/Unit/BackendTest.php
index 2d06d78..dc6596e 100644
--- a/tests/phpunit/Unit/BackendTest.php
+++ b/tests/phpunit/Unit/BackendTest.php
@@ -47,7 +47,6 @@
        public function testGetMessageLog_withLogGivenToConstructor() {
 
                $log = $this->getMock( '\Lingo\MessageLog' );
-               $logRef = &$log;
 
                $stub = $this->getMockBuilder( '\Lingo\Backend' )
                        ->disableOriginalConstructor()
@@ -55,7 +54,7 @@
 
                $reflected = new \ReflectionClass( '\Lingo\Backend' );
                $constructor = $reflected->getConstructor();
-               $constructor->invoke( $stub, $logRef );
+               $constructor->invokeArgs( $stub, array( &$log ) );
 
                $this->assertEquals( $log, $stub->getMessageLog() );
        }
diff --git a/tests/phpunit/Unit/BasicBackendTest.php 
b/tests/phpunit/Unit/BasicBackendTest.php
index f622880..a3eb9d4 100644
--- a/tests/phpunit/Unit/BasicBackendTest.php
+++ b/tests/phpunit/Unit/BasicBackendTest.php
@@ -299,7 +299,6 @@
         */
        protected function getTestObject( $lingoPageText = '', $action = 
'view', $interwiki = '', $lingoPageRevision = false, $lingoPageContent = false, 
$lingoApprovedText = '' ) {
                $messageLog = $this->getMock( 'Lingo\MessageLog' );
-               $messageLogRef =& $messageLog;
 
                $backend = $this->getMockBuilder( 'Lingo\BasicBackend' )
                        ->disableOriginalConstructor()
@@ -312,7 +311,7 @@
 
                $reflected = new \ReflectionClass( '\Lingo\BasicBackend' );
                $constructor = $reflected->getConstructor();
-               $constructor->invoke( $backend, $messageLogRef );
+               $constructor->invokeArgs( $backend, array( &$messageLog ) );
 
                $GLOBALS[ 'wgLingoPageName' ] = 'SomePage';
 
diff --git a/tests/phpunit/Unit/LingoI18NTest.php 
b/tests/phpunit/Unit/LingoI18NTest.php
index 3f3174a..af5c114 100644
--- a/tests/phpunit/Unit/LingoI18NTest.php
+++ b/tests/phpunit/Unit/LingoI18NTest.php
@@ -26,8 +26,6 @@
 
 namespace Lingo\Tests\Unit;
 
-use JsonSchema\Validator;
-
 /**
  * @group extensions-lingo
  * @group extensions-lingo-unit
@@ -37,6 +35,11 @@
  * @ingroup Test
  */
 class LingoI18NTest extends \PHPUnit_Framework_TestCase {
+
+       public function testJsonSchemaValidatorExists(){
+               $this->assertTrue( class_exists( '\JsonSchema\Validator' ) );
+               $this->assertTrue( method_exists('\JsonSchema\Validator', 
'check' ) );
+       }
 
        public function testMagicWordsLoaded() {
 
@@ -51,7 +54,7 @@
 
                $data = json_decode( json_encode( $defined_vars[ 'magicWords' ] 
) );
 
-               $validator = new Validator();
+               $validator = new \JsonSchema\Validator();
                $validator->check( $data, (object) array( '$ref' =>
                        'file://' . realpath( __DIR__ . 
'/../Fixture/magicWordsSchema.json' ) ) );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I011232bacffc46d18233befcbc26cfc8a1b0257e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Lingo
Gerrit-Branch: master
Gerrit-Owner: Foxtrott <[email protected]>

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

Reply via email to