r96938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96937‎ | r96938 | r96939 >
Date:02:01, 13 September 2011
Author:preilly
Status:ok
Tags:
Comment:
fix method names add new test for vary header support
Modified paths:
  • /trunk/extensions/MobileFrontend/tests/MobileFrontendTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/tests/MobileFrontendTest.php
@@ -23,21 +23,21 @@
2424 parent::tearDown();
2525 }
2626
27 - public function testgetBaseDomain() {
 27+ public function testGetBaseDomain() {
2828 $getBaseDomain = self::getMethod( 'getBaseDomain' );
2929 $wgExtMobileFrontend = new ExtMobileFrontend();
3030 $_SERVER['HTTP_HOST'] = 'en.wikipedia.org';
3131 $this->assertEquals( '.wikipedia.org', $getBaseDomain->invokeArgs( $wgExtMobileFrontend, array() ) );
3232 }
3333
34 - public function testgetRelativeURL() {
 34+ public function testGetRelativeURL() {
3535 $getRelativeURL = self::getMethod( 'getRelativeURL' );
3636 $wgExtMobileFrontend = new ExtMobileFrontend();
3737 $url = 'http://en.wikipedia.org/wiki/Positional_astronomy';
3838 $this->assertEquals( '/wiki/Positional_astronomy', $getRelativeURL->invokeArgs( $wgExtMobileFrontend, array( $url ) ) );
3939 }
4040
41 - public function testdisableCaching() {
 41+ public function testDisableCaching() {
4242 global $wgRequest;
4343 $disableCaching = self::getMethod( 'disableCaching' );
4444 $wgExtMobileFrontend = new ExtMobileFrontend();
@@ -47,4 +47,13 @@
4848 $this->assertEquals( 'Sat, 26 Jul 1997 05:00:00 GMT', $wgRequest->response()->getheader( 'Expires' ) );
4949 $this->assertEquals( 'no-cache', $wgRequest->response()->getheader( 'Pragma' ) );
5050 }
 51+
 52+ public function testSendXDeviceVaryHeader() {
 53+ global $wgRequest;
 54+ $sendXDeviceVaryHeader = self::getMethod( 'sendXDeviceVaryHeader' );
 55+ $wgExtMobileFrontend = new ExtMobileFrontend();
 56+ $_SERVER['HTTP_X_DEVICE'] = 'device';
 57+ $sendXDeviceVaryHeader->invokeArgs( $wgExtMobileFrontend, array() );
 58+ $this->assertEquals( $_SERVER['HTTP_X_DEVICE'], $wgRequest->response()->getheader( 'X-Device' ) );
 59+ }
5160 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96935add basic unit test support and small fix for formattingpreilly01:35, 13 September 2011

Status & tagging log