Umherirrender has uploaded a new change for review.

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

Change subject: Use assertSame in LogFormatterTestCase
......................................................................

Use assertSame in LogFormatterTestCase

Using assertSame also checks for internal types to be correct.

Needs the following fixes:
- MergeLogFormatterTest: Use correct array key order
- NewUsersLogFormatterTest: Input user id as integer
- PatrolLogFormatter: Ensure in LogFormatter that
  integer is not casted to float

Change-Id: I2cab5335d6654f6cda15fc4e9fbae2c1ca1b27ff
---
M includes/logging/LogFormatter.php
M tests/phpunit/includes/logging/LogFormatterTestCase.php
M tests/phpunit/includes/logging/MergeLogFormatterTest.php
M tests/phpunit/includes/logging/NewUsersLogFormatterTest.php
4 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/31/216431/1

diff --git a/includes/logging/LogFormatter.php 
b/includes/logging/LogFormatter.php
index 119492b..0145b02 100644
--- a/includes/logging/LogFormatter.php
+++ b/includes/logging/LogFormatter.php
@@ -790,7 +790,7 @@
                                break;
 
                        case 'number':
-                               if ( ctype_digit( $value ) ) {
+                               if ( ctype_digit( $value ) || is_int( $value ) 
) {
                                        $value = (int)$value;
                                } else {
                                        $value = (float)$value;
diff --git a/tests/phpunit/includes/logging/LogFormatterTestCase.php 
b/tests/phpunit/includes/logging/LogFormatterTestCase.php
index e58711f..cab6794 100644
--- a/tests/phpunit/includes/logging/LogFormatterTestCase.php
+++ b/tests/phpunit/includes/logging/LogFormatterTestCase.php
@@ -17,7 +17,7 @@
                        'Action text is equal to expected text'
                );
 
-               $this->assertEquals(
+               $this->assertSame( // ensure types and array key order
                        $extra['api'],
                        self::removeApiMetaData( 
$formatter->formatParametersForApi() ),
                        'Api log params is equal to expected array'
diff --git a/tests/phpunit/includes/logging/MergeLogFormatterTest.php 
b/tests/phpunit/includes/logging/MergeLogFormatterTest.php
index 5a0b906..2ff0ddf 100644
--- a/tests/phpunit/includes/logging/MergeLogFormatterTest.php
+++ b/tests/phpunit/includes/logging/MergeLogFormatterTest.php
@@ -25,9 +25,9 @@
                                array(
                                        'text' => 'User merged OldPage into 
NewPage (revisions up to 16:07, 4 August 2014)',
                                        'api' => array(
-                                               'mergepoint' => 
'2014-08-04T16:07:10Z',
                                                'dest_ns' => 0,
                                                'dest_title' => 'NewPage',
+                                               'mergepoint' => 
'2014-08-04T16:07:10Z',
                                        ),
                                ),
                        ),
@@ -49,9 +49,9 @@
                                        'legacy' => true,
                                        'text' => 'User merged OldPage into 
NewPage (revisions up to 16:07, 4 August 2014)',
                                        'api' => array(
-                                               'mergepoint' => 
'2014-08-04T16:07:10Z',
                                                'dest_ns' => 0,
                                                'dest_title' => 'NewPage',
+                                               'mergepoint' => 
'2014-08-04T16:07:10Z',
                                        ),
                                ),
                        ),
diff --git a/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php 
b/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php
index 13dd839..5b03370 100644
--- a/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php
+++ b/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php
@@ -71,7 +71,7 @@
                                        'namespace' => NS_USER,
                                        'title' => 'New user',
                                        'params' => array(
-                                               '4::userid' => '1',
+                                               '4::userid' => 1,
                                        ),
                                ),
                                array(
@@ -109,7 +109,7 @@
                                        'namespace' => NS_USER,
                                        'title' => 'UTSysop',
                                        'params' => array(
-                                               '4::userid' => '1',
+                                               '4::userid' => 1,
                                        ),
                                ),
                                array(
@@ -147,7 +147,7 @@
                                        'namespace' => NS_USER,
                                        'title' => 'UTSysop',
                                        'params' => array(
-                                               '4::userid' => '1',
+                                               '4::userid' => 1,
                                        ),
                                ),
                                array(
@@ -185,7 +185,7 @@
                                        'namespace' => NS_USER,
                                        'title' => 'New user',
                                        'params' => array(
-                                               '4::userid' => '1',
+                                               '4::userid' => 1,
                                        ),
                                ),
                                array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cab5335d6654f6cda15fc4e9fbae2c1ca1b27ff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>

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

Reply via email to