Merge "Add SPARQL client to core"
[lhc/web/wiklou.git] / tests / phpunit / includes / mail / MailAddressTest.php
index 18d2acd..d0bd698 100644 (file)
@@ -7,7 +7,7 @@ class MailAddressTest extends MediaWikiTestCase {
         */
        public function testConstructor() {
                $ma = new MailAddress( 'foo@bar.baz', 'UserName', 'Real name' );
-               $this->assertInstanceOf( 'MailAddress', $ma );
+               $this->assertInstanceOf( MailAddress::class, $ma );
        }
 
        /**
@@ -17,13 +17,19 @@ 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::class );
+               $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 );
+               $this->assertInstanceOf( MailAddress::class, $ma );
                $this->setMwGlobals( 'wgEnotifUseRealName', true );
                $this->assertEquals( 'Real name <foo@bar.baz>', $ma->toString() );
                $this->setMwGlobals( 'wgEnotifUseRealName', false );
@@ -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, '', '', '', '' ],
+               ];
        }
 
        /**