Merge "SpecialNewFiles: Swap from/to date serverside"
[lhc/web/wiklou.git] / tests / phpunit / includes / exception / ErrorPageErrorTest.php
index 13dcf33..e72865f 100644 (file)
@@ -2,24 +2,10 @@
 
 /**
  * @covers ErrorPageError
- * @author Adam Shorland
+ * @author Addshore
  */
 class ErrorPageErrorTest extends MediaWikiTestCase {
 
-       private $wgOut;
-
-       protected function setUp() {
-               parent::setUp();
-               global $wgOut;
-               $this->wgOut = clone $wgOut;
-       }
-
-       protected function tearDown() {
-               global $wgOut;
-               $wgOut = $this->wgOut;
-               parent::tearDown();
-       }
-
        private function getMockMessage() {
                $mockMessage = $this->getMockBuilder( 'Message' )
                        ->disableOriginalConstructor()
@@ -36,7 +22,7 @@ class ErrorPageErrorTest extends MediaWikiTestCase {
        public function testConstruction() {
                $mockMessage = $this->getMockMessage();
                $title = 'Foo';
-               $params = array( 'Baz' );
+               $params = [ 'Baz' ];
                $e = new ErrorPageError( $title, $mockMessage, $params );
                $this->assertEquals( $title, $e->title );
                $this->assertEquals( $mockMessage, $e->msg );
@@ -46,22 +32,21 @@ class ErrorPageErrorTest extends MediaWikiTestCase {
        public function testReport() {
                $mockMessage = $this->getMockMessage();
                $title = 'Foo';
-               $params = array( 'Baz' );
+               $params = [ 'Baz' ];
 
-               global $wgOut;
-               $wgOut = $this->getMockBuilder( 'OutputPage' )
+               $mock = $this->getMockBuilder( 'OutputPage' )
                        ->disableOriginalConstructor()
                        ->getMock();
-               $wgOut->expects( $this->once() )
+               $mock->expects( $this->once() )
                        ->method( 'showErrorPage' )
                        ->with( $title, $mockMessage, $params );
-               $wgOut->expects( $this->once() )
+               $mock->expects( $this->once() )
                        ->method( 'output' );
+               $this->setMwGlobals( 'wgOut', $mock );
+               $this->setMwGlobals( 'wgCommandLineMode', false );
 
                $e = new ErrorPageError( $title, $mockMessage, $params );
                $e->report();
        }
 
-
-
 }