Foxtrott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/277055

Change subject: Improve tests
......................................................................

Improve tests

Change-Id: I98d718ec46eab6de26a6577b97179cefec89680b
---
M docs/release-notes.md
M extension.json
M tests/phpunit/Integration/ArticleAnnotationTest.php
M tests/phpunit/Unit/BackendTest.php
4 files changed, 39 insertions(+), 9 deletions(-)


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

diff --git a/docs/release-notes.md b/docs/release-notes.md
index 98e1f89..71219e1 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -1,10 +1,20 @@
 ## Release Notes
 
-### Lingo 2.0.1
+### Lingo 2.0.2
 
 Released on tbd
 
 Changes:
+
+
+Fixes:
+
+
+### Lingo 2.0.1
+
+Released on 13-Mar-2016
+
+Changes:
 * Improved test coverage
 
 Fixes:
diff --git a/extension.json b/extension.json
index 990c892..99b1e47 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
        "name": "Lingo",
-       "version": "2.0.1",
+       "version": "2.0.2-dev",
        "author": [
                "Barry Coughlan",
                "[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]",
diff --git a/tests/phpunit/Integration/ArticleAnnotationTest.php 
b/tests/phpunit/Integration/ArticleAnnotationTest.php
index 9966d56..6526897 100644
--- a/tests/phpunit/Integration/ArticleAnnotationTest.php
+++ b/tests/phpunit/Integration/ArticleAnnotationTest.php
@@ -50,6 +50,9 @@
 class ArticleAnnotationTest extends \PHPUnit_Framework_TestCase {
 
        public function setup() {
+
+               $GLOBALS[ 'wgexLingoDisplayOnce' ] = false;
+
        }
 
        public function tearDown() {
@@ -107,7 +110,9 @@
                        $json = json_encode( $xml );
                        $decoded = json_decode( $json, TRUE );
 
+                       // suppress warnings for non-existant array keys
                        \MediaWiki\suppressWarnings();
+
                        $testCase = array(
                                0 => substr( $file, strlen( __DIR__ . 
'/../Fixture/articleAnnotation' ) ),
                                1 => $decoded[ 'text' ],
@@ -116,14 +121,13 @@
                        );
 
                        if ( array_key_exists( 'term', $decoded[ 
'glossary-entry' ] ) ) {
-
-                               $testCase[ 2 ][] = array( $decoded[ 
'glossary-entry' ][ 'term' ], $decoded[ 'glossary-entry' ][ 'definition' ], 
$decoded[ 'glossary-entry' ][ 'link' ], $decoded[ 'glossary-entry' ][ 'style' ] 
);
-
-                       } else {
-                               foreach ( $decoded[ 'glossary-entry' ] as 
$entry ) {
-                                       $testCase[ 2 ][] = array( $entry[ 
'term' ], $entry[ 'definition' ], $entry[ 'link' ], $entry[ 'style' ] );
-                               }
+                               $decoded[ 'glossary-entry' ] = array( $decoded[ 
'glossary-entry' ] );
                        }
+
+                       foreach ( $decoded[ 'glossary-entry' ] as $entry ) {
+                               $testCase[ 2 ][] = array( $entry[ 'term' ], 
$entry[ 'definition' ], $entry[ 'link' ], $entry[ 'style' ] );
+                       }
+
                        \MediaWiki\restoreWarnings();
 
                        $data[] = $testCase;
diff --git a/tests/phpunit/Unit/BackendTest.php 
b/tests/phpunit/Unit/BackendTest.php
index e0e503f..04e1672 100644
--- a/tests/phpunit/Unit/BackendTest.php
+++ b/tests/phpunit/Unit/BackendTest.php
@@ -47,4 +47,20 @@
                $this->assertFalse( $stub->useCache() );
        }
 
+       public function testGetMessageLog() {
+
+               $log = $this->getMock( '\Lingo\MessageLog' );
+               $logRef = &$log;
+
+               $stub = $this->getMockBuilder( '\Lingo\Backend' )
+                       ->disableOriginalConstructor()
+                       ->getMockForAbstractClass();
+
+               $reflected = new \ReflectionClass( '\Lingo\Backend' );
+               $constructor = $reflected->getConstructor();
+               $constructor->invoke( $stub, $logRef );
+
+               $this->assertEquals( $log, $stub->getMessageLog() );
+       }
+
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98d718ec46eab6de26a6577b97179cefec89680b
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