Merge "phpunit: Avoid use of deprecated getMock for PHPUnit 5 compat"
[lhc/web/wiklou.git] / tests / phpunit / includes / mail / MailAddressTest.php
index 18d2acd..c837d26 100644 (file)
@@ -17,10 +17,16 @@ class MailAddressTest extends MediaWikiTestCase {
                if ( wfIsWindows() ) {
                        $this->markTestSkipped( 'This test only works on non-Windows platforms' );
                }
-               $user = $this->getMock( 'User' );
-               $user->expects( $this->any() )->method( 'getName' )->will( $this->returnValue( 'UserName' ) );
-               $user->expects( $this->any() )->method( 'getEmail' )->will( $this->returnValue( 'foo@bar.baz' ) );
-               $user->expects( $this->any() )->method( 'getRealName' )->will( $this->returnValue( 'Real name' ) );
+               $user = $this->createMock( 'User' );
+               $user->expects( $this->any() )->method( 'getName' )->will(
+                       $this->returnValue( 'UserName' )
+               );
+               $user->expects( $this->any() )->method( 'getEmail' )->will(
+                       $this->returnValue( 'foo@bar.baz' )
+               );
+               $user->expects( $this->any() )->method( 'getRealName' )->will(
+                       $this->returnValue( 'Real name' )
+               );
 
                $ma = MailAddress::newFromUser( $user );
                $this->assertInstanceOf( 'MailAddress', $ma );
@@ -44,16 +50,16 @@ class MailAddressTest extends MediaWikiTestCase {
        }
 
        public static function provideToString() {
-               return array(
-                       array( true, 'foo@bar.baz', 'FooBar', 'Foo Bar', 'Foo Bar <foo@bar.baz>' ),
-                       array( true, 'foo@bar.baz', 'UserName', null, 'UserName <foo@bar.baz>' ),
-                       array( true, 'foo@bar.baz', 'AUser', 'My real name', 'My real name <foo@bar.baz>' ),
-                       array( true, 'foo@bar.baz', 'A.user.name', 'my@real.name', '"my@real.name" <foo@bar.baz>' ),
-                       array( false, 'foo@bar.baz', 'AUserName', 'Some real name', 'AUserName <foo@bar.baz>' ),
-                       array( false, 'foo@bar.baz', '', '', 'foo@bar.baz' ),
-                       array( true, 'foo@bar.baz', '', '', 'foo@bar.baz' ),
-                       array( true, '', '', '', '' ),
-               );
+               return [
+                       [ true, 'foo@bar.baz', 'FooBar', 'Foo Bar', 'Foo Bar <foo@bar.baz>' ],
+                       [ true, 'foo@bar.baz', 'UserName', null, 'UserName <foo@bar.baz>' ],
+                       [ true, 'foo@bar.baz', 'AUser', 'My real name', 'My real name <foo@bar.baz>' ],
+                       [ true, 'foo@bar.baz', 'A.user.name', 'my@real.name', '"my@real.name" <foo@bar.baz>' ],
+                       [ false, 'foo@bar.baz', 'AUserName', 'Some real name', 'AUserName <foo@bar.baz>' ],
+                       [ false, 'foo@bar.baz', '', '', 'foo@bar.baz' ],
+                       [ true, 'foo@bar.baz', '', '', 'foo@bar.baz' ],
+                       [ true, '', '', '', '' ],
+               ];
        }
 
        /**