From: ryan10145 Date: Thu, 4 Jan 2018 02:41:02 +0000 (-0500) Subject: Added Tests for ListToggle X-Git-Tag: 1.31.0-rc.0~992^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22statistiques_visites%22%2C%22%22%29%20.%20%22?a=commitdiff_plain;h=31045933a1f02369030d4f3d2dfc922a2eeb6a56;p=lhc%2Fweb%2Fwiklou.git Added Tests for ListToggle Bug: T183898 Change-Id: I1c6cd8ea21127db56701cc6073fa880b2180d846 --- diff --git a/tests/phpunit/includes/ListToggleTest.php b/tests/phpunit/includes/ListToggleTest.php new file mode 100644 index 0000000000..7bbf448191 --- /dev/null +++ b/tests/phpunit/includes/ListToggleTest.php @@ -0,0 +1,49 @@ +getMockBuilder( 'OutputPage' ) + ->setMethods( null ) + ->disableOriginalConstructor() + ->getMock(); + + $listToggle = new ListToggle( $output ); + + $this->assertInstanceOf( 'ListToggle', $listToggle ); + $this->assertContains( 'mediawiki.checkboxtoggle', $output->getModules() ); + $this->assertContains( 'mediawiki.checkboxtoggle.styles', $output->getModuleStyles() ); + } + + /** + * @covers ListToggle::getHTML + */ + public function testGetHTML() { + $output = $this->createMock( 'OutputPage' ); + $output->expects( $this->any() ) + ->method( 'msg' ) + ->will( $this->returnCallback( function ( $key ) { + return wfMessage( $key )->inLanguage( 'qqx' ); + } ) ); + $output->expects( $this->once() ) + ->method( 'getLanguage' ) + ->will( $this->returnValue( Language::factory( 'qqx' ) ) ); + + $listToggle = new ListToggle( $output ); + + $html = $listToggle->getHTML(); + $this->assertEquals( '
' . + '(checkbox-select: (checkbox-all)(comma-separator)' . + '' . + '(checkbox-none)(comma-separator)(checkbox-invert))
', + $html ); + } +}