Add missing visibility keywords everywhere

Change-Id: I270d1dd9b6545e15398c2f8b8e9ae533844cc998
This commit is contained in:
Thiemo Mättig 2014-11-12 12:43:44 +01:00
parent 61af67b819
commit 55fe0b69d0
12 changed files with 44 additions and 49 deletions

View file

@ -91,7 +91,7 @@ abstract class ScribuntoEngineBase {
}
}
function __destruct() {
public function __destruct() {
$this->destroy();
}

View file

@ -71,7 +71,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
);
}
function getTestModules() {
protected function getTestModules() {
return parent::getTestModules() + array(
'CommonTests' => __DIR__ . '/CommonTests.lua',
'CommonTests-data' => __DIR__ . '/CommonTests-data.lua',
@ -83,7 +83,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
);
}
function testNoLeakedGlobals() {
public function testNoLeakedGlobals() {
$interpreter = $this->getEngine()->getInterpreter();
list( $actualGlobals ) = $interpreter->callFunction(
@ -99,7 +99,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
);
}
function testPHPLibrary() {
public function testPHPLibrary() {
$engine = $this->getEngine();
$frame = $engine->getParser()->getPreprocessor()->newFrame();
@ -191,7 +191,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
'library is not recreated between invokes' );
}
function testModuleStringExtend() {
public function testModuleStringExtend() {
$engine = $this->getEngine();
$interpreter = $engine->getInterpreter();
@ -265,7 +265,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
);
}
function testLoadDataLoadedOnce() {
public function testLoadDataLoadedOnce() {
$engine = $this->getEngine();
$interpreter = $engine->getInterpreter();
$frame = $engine->getParser()->getPreprocessor()->newFrame();
@ -311,7 +311,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
);
}
function testFrames() {
public function testFrames() {
$engine = $this->getEngine();
$ret = $engine->runConsole( array(
@ -342,7 +342,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
$this->assertSame( "ok\ttable", $ret['return'], 'child frames have correct parents' );
}
function testCallParserFunction() {
public function testCallParserFunction() {
global $wgContLang;
$engine = $this->getEngine();
@ -471,7 +471,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
}
}
function testBug62291() {
public function testBug62291() {
$engine = $this->getEngine();
$frame = $engine->getParser()->getPreprocessor()->newFrame();
@ -514,7 +514,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
$this->assertSame( $r1, $r2, 'Multiple invokes with recursive invoke returned different sets of random numbers' );
}
function testOsDateTimeTTLs() {
public function testOsDateTimeTTLs() {
$engine = $this->getEngine();
$pp = $engine->getParser()->getPreprocessor();
@ -587,7 +587,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
/**
* @dataProvider provideVolatileCaching
*/
function testVolatileCaching( $func ) {
public function testVolatileCaching( $func ) {
$engine = $this->getEngine();
$parser = $engine->getParser();
$pp = $parser->getPreprocessor();
@ -626,7 +626,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
$this->assertEquals( '1 2', $text, "Volatile wikitext was not cached" );
}
function provideVolatileCaching() {
public function provideVolatileCaching() {
return array(
array( 'preprocess' ),
array( 'extensionTag' ),
@ -634,7 +634,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
);
}
function testGetCurrentFrameAndMWLoadData() {
public function testGetCurrentFrameAndMWLoadData() {
$engine = $this->getEngine();
$parser = $engine->getParser();
$pp = $parser->getPreprocessor();
@ -654,7 +654,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
$this->assertEquals( 'ok', $text, 'mw.loadData allowed access to frame args' );
}
function testGetCurrentFrameAtModuleScope() {
public function testGetCurrentFrameAtModuleScope() {
$engine = $this->getEngine();
$parser = $engine->getParser();
$pp = $parser->getPreprocessor();

View file

@ -3,7 +3,7 @@
class Scribunto_LuaLanguageLibraryTests extends Scribunto_LuaEngineTestBase {
protected static $moduleName = 'LanguageLibraryTests';
function __construct( $name = null, array $data = array(), $dataName = '', $engineName = null ) {
public function __construct( $name = null, array $data = array(), $dataName = '', $engineName = null ) {
parent::__construct( $name, $data, $dataName, $engineName );
// Skip certain tests if something isn't providing translated language names
@ -19,13 +19,13 @@ class Scribunto_LuaLanguageLibraryTests extends Scribunto_LuaEngineTestBase {
}
}
function getTestModules() {
protected function getTestModules() {
return parent::getTestModules() + array(
'LanguageLibraryTests' => __DIR__ . '/LanguageLibraryTests.lua',
);
}
function testFormatDateTTLs() {
public function testFormatDateTTLs() {
global $wgContLang;
$engine = $this->getEngine();

View file

@ -54,7 +54,7 @@ abstract class Scribunto_LuaEngineTestBase extends MediaWikiTestCase {
*/
protected $skipTests = array();
function __construct( $name = null, array $data = array(), $dataName = '', $engineName = null ) {
public function __construct( $name = null, array $data = array(), $dataName = '', $engineName = null ) {
if ( $engineName === null ) {
$engineName = self::$staticEngineName;
}

View file

@ -21,7 +21,7 @@ class Scribunto_LuaEnvironmentComparisonTest extends MediaWikiTestCase {
protected $engines = array();
function makeEngine( $class, $opts ) {
private function makeEngine( $class, $opts ) {
$parser = new Parser;
$options = new ParserOptions;
$options->setTemplateCallback( array( $this, 'templateCallback' ) );
@ -95,7 +95,7 @@ LUA;
return $engine->getInterpreter()->callFunction( $func );
}
function testGlobalEnvironment() {
public function testGlobalEnvironment() {
// Grab the first engine as the "standard"
reset( $this->engines );
list( $firstName, $firstEngine ) = each( $this->engines );

View file

@ -1,7 +1,7 @@
<?php
abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
abstract function newInterpreter( $opts = array() );
protected abstract function newInterpreter( $opts = array() );
protected function setUp() {
parent::setUp();
@ -12,7 +12,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
}
}
function getBusyLoop( $interpreter ) {
protected function getBusyLoop( $interpreter ) {
$chunk = $interpreter->loadString( '
local args = {...}
local x, i
@ -25,12 +25,8 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
return $chunk;
}
function getPassthru( $interpreter ) {
return $interpreter->loadString( 'return ...', 'passthru' );
}
/** @dataProvider provideRoundtrip */
function testRoundtrip( /*...*/ ) {
public function testRoundtrip( /*...*/ ) {
$args = func_get_args();
$args = $this->normalizeOrder( $args );
$interpreter = $this->newInterpreter();
@ -43,7 +39,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
}
/** @dataProvider provideRoundtrip */
function testDoubleRoundtrip( /* ... */ ) {
public function testDoubleRoundtrip( /* ... */ ) {
$args = func_get_args();
$args = $this->normalizeOrder( $args );
@ -64,7 +60,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
* This cannot be done in testRoundtrip and testDoubleRoundtrip, because
* assertSame( NAN, NAN ) returns false.
*/
function testRoundtripNAN() {
public function testRoundtripNAN() {
$interpreter = $this->newInterpreter();
$passthru = $interpreter->loadString( 'return ...', 'passthru' );
@ -79,7 +75,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
$this->assertTrue( is_nan( $ret[0] ), 'NaN was not double passed through' );
}
function normalizeOrder( $a ) {
private function normalizeOrder( $a ) {
ksort( $a );
foreach ( $a as &$value ) {
if ( is_array( $value ) ) {
@ -89,12 +85,12 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
return $a;
}
function passthru( /* ... */ ) {
public function passthru( /* ... */ ) {
$args = func_get_args();
return $args;
}
function provideRoundtrip() {
public function provideRoundtrip() {
return array(
array( 1 ),
array( true ),
@ -119,7 +115,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
* @expectedException ScribuntoException
* @expectedExceptionMessage The time allocated for running scripts has expired.
*/
function testTimeLimit() {
public function testTimeLimit() {
if( php_uname( 's' ) === 'Darwin' ) {
$this->markTestSkipped( "Darwin is lacking POSIX timer, skipping CPU time limiting test." );
}
@ -133,7 +129,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
* @expectedException ScribuntoException
* @expectedExceptionMessage Lua error: not enough memory
*/
function testTestMemoryLimit() {
public function testTestMemoryLimit() {
$interpreter = $this->newInterpreter( array( 'memoryLimit' => 20 * 1e6 ) );
$chunk = $interpreter->loadString( '
t = {}
@ -145,7 +141,7 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
$interpreter->callFunction( $chunk );
}
function testWrapPHPFunction() {
public function testWrapPHPFunction() {
$interpreter = $this->newInterpreter();
$func = $interpreter->wrapPhpFunction( function ( $n ) {
return array( 42, $n );
@ -162,4 +158,3 @@ abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
$this->assertEquals( array( 42, 'From Lua' ), $res );
}
}

View file

@ -3,7 +3,7 @@
class Scribunto_LuaMessageLibraryTests extends Scribunto_LuaEngineTestBase {
protected static $moduleName = 'MessageLibraryTests';
function getTestModules() {
protected function getTestModules() {
return parent::getTestModules() + array(
'MessageLibraryTests' => __DIR__ . '/MessageLibraryTests.lua',
);

View file

@ -115,7 +115,7 @@ class Scribunto_LuaTitleLibraryTests extends Scribunto_LuaEngineTestBase {
);
}
function testAddsLinks() {
public function testAddsLinks() {
$engine = $this->getEngine();
$interpreter = $engine->getInterpreter();

View file

@ -20,7 +20,7 @@ class Scribunto_LuaUstringLibraryTests extends Scribunto_LuaEngineTestBase {
);
}
function testUstringLibraryNormalizationTestsAvailable() {
public function testUstringLibraryNormalizationTestsAvailable() {
if ( UstringLibraryNormalizationTestProvider::available( $err ) ) {
$this->assertTrue( true );
} else {
@ -28,7 +28,7 @@ class Scribunto_LuaUstringLibraryTests extends Scribunto_LuaEngineTestBase {
}
}
function provideUstringLibraryNormalizationTests() {
public function provideUstringLibraryNormalizationTests() {
if ( !$this->normalizationDataProvider ) {
$this->normalizationDataProvider = new UstringLibraryNormalizationTestProvider( $this->getEngine() );
}
@ -38,7 +38,7 @@ class Scribunto_LuaUstringLibraryTests extends Scribunto_LuaEngineTestBase {
/**
* @dataProvider provideUstringLibraryNormalizationTests
*/
function testUstringLibraryNormalizationTests( $name, $c1, $c2, $c3, $c4, $c5 ) {
public function testUstringLibraryNormalizationTests( $name, $c1, $c2, $c3, $c4, $c5 ) {
$this->luaTestName = "UstringLibraryNormalization: $name";
$dataProvider = $this->provideUstringLibraryNormalizationTests();
$expected = array( $c2, $c2, $c2, $c4, $c4, $c3, $c3, $c3, $c5, $c5 );

View file

@ -13,13 +13,13 @@ class Scribunto_LuaSandboxInterpreterTest extends Scribunto_LuaInterpreterTest {
'cpuLimit' => 30,
);
function newInterpreter( $opts = array() ) {
protected function newInterpreter( $opts = array() ) {
$opts = $opts + $this->stdOpts;
$engine = new Scribunto_LuaSandboxEngine( $this->stdOpts );
return new Scribunto_LuaSandboxInterpreter( $engine, $opts );
}
function testGetMemoryUsage() {
public function testGetMemoryUsage() {
$interpreter = $this->newInterpreter();
$chunk = $interpreter->loadString( 's = string.rep("x", 1000000)', 'mem' );
$interpreter->callFunction( $chunk );

View file

@ -7,13 +7,13 @@ class Scribunto_LuaSandboxTests extends Scribunto_LuaEngineTestBase {
return self::makeSuite( $className, 'LuaSandbox' );
}
function getTestModules() {
protected function getTestModules() {
return parent::getTestModules() + array(
'SandboxTests' => __DIR__ . '/SandboxTests.lua',
);
}
function testArgumentParsingTime() {
public function testArgumentParsingTime() {
$engine = $this->getEngine();
if ( !is_callable( array( $engine->getInterpreter()->sandbox, 'pauseUsageTimer' ) ) ) {
$this->markTestSkipped( "LuaSandbox::pauseUsageTimer is not available" );

View file

@ -15,18 +15,18 @@ class Scribunto_LuaStandaloneInterpreterTest extends Scribunto_LuaInterpreterTes
'cpuLimit' => 30,
);
function getVsize( $pid ) {
private function getVsize( $pid ) {
$size = wfShellExec( wfEscapeShellArg( 'ps', '-p', $pid, '-o', 'vsz', '--no-headers' ) );
return $size * 1024;
}
function newInterpreter( $opts = array() ) {
protected function newInterpreter( $opts = array() ) {
$opts = $opts + $this->stdOpts;
$engine = new Scribunto_LuaStandaloneEngine( $this->stdOpts );
return new Scribunto_LuaStandaloneInterpreter( $engine, $opts );
}
function testGetStatus() {
public function testGetStatus() {
$startTime = microtime( true );
if ( php_uname( 's' ) !== 'Linux' ) {
$this->markTestSkipped( "getStatus() not supported on platforms other than Linux" );
@ -52,7 +52,7 @@ class Scribunto_LuaStandaloneInterpreterTest extends Scribunto_LuaInterpreterTes
$this->assertEquals( $vsize, $status['vsize'], 'vsize', $vsize * 0.1 );
}
function testFreeFunctions() {
public function testFreeFunctions() {
$interpreter = $this->newInterpreter();
// Test #1: Make sure freeing actually works