Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/172691
Change subject: Add missing visibility keywords everywhere ...................................................................... Add missing visibility keywords everywhere Change-Id: I270d1dd9b6545e15398c2f8b8e9ae533844cc998 --- M common/Base.php M tests/engines/LuaCommon/CommonTest.php M tests/engines/LuaCommon/LanguageLibraryTest.php M tests/engines/LuaCommon/LuaEngineTestBase.php M tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php M tests/engines/LuaCommon/LuaInterpreterTest.php M tests/engines/LuaCommon/MessageLibraryTest.php M tests/engines/LuaCommon/TitleLibraryTest.php M tests/engines/LuaCommon/UstringLibraryTest.php M tests/engines/LuaSandbox/LuaSandboxInterpreterTest.php M tests/engines/LuaSandbox/SandboxTest.php M tests/engines/LuaStandalone/LuaStandaloneInterpreterTest.php 12 files changed, 44 insertions(+), 49 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto refs/changes/91/172691/1 diff --git a/common/Base.php b/common/Base.php index 1fbf945..850cb44 100644 --- a/common/Base.php +++ b/common/Base.php @@ -91,7 +91,7 @@ } } - function __destruct() { + public function __destruct() { $this->destroy(); } diff --git a/tests/engines/LuaCommon/CommonTest.php b/tests/engines/LuaCommon/CommonTest.php index 19504f7..5ccce8b 100644 --- a/tests/engines/LuaCommon/CommonTest.php +++ b/tests/engines/LuaCommon/CommonTest.php @@ -71,7 +71,7 @@ ); } - function getTestModules() { + public function getTestModules() { return parent::getTestModules() + array( 'CommonTests' => __DIR__ . '/CommonTests.lua', 'CommonTests-data' => __DIR__ . '/CommonTests-data.lua', @@ -83,7 +83,7 @@ ); } - function testNoLeakedGlobals() { + public function testNoLeakedGlobals() { $interpreter = $this->getEngine()->getInterpreter(); list( $actualGlobals ) = $interpreter->callFunction( @@ -99,7 +99,7 @@ ); } - function testPHPLibrary() { + public function testPHPLibrary() { $engine = $this->getEngine(); $frame = $engine->getParser()->getPreprocessor()->newFrame(); @@ -191,7 +191,7 @@ 'library is not recreated between invokes' ); } - function testModuleStringExtend() { + public function testModuleStringExtend() { $engine = $this->getEngine(); $interpreter = $engine->getInterpreter(); @@ -265,7 +265,7 @@ ); } - function testLoadDataLoadedOnce() { + public function testLoadDataLoadedOnce() { $engine = $this->getEngine(); $interpreter = $engine->getInterpreter(); $frame = $engine->getParser()->getPreprocessor()->newFrame(); @@ -311,7 +311,7 @@ ); } - function testFrames() { + public function testFrames() { $engine = $this->getEngine(); $ret = $engine->runConsole( array( @@ -342,7 +342,7 @@ $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 @@ } } - function testBug62291() { + public function testBug62291() { $engine = $this->getEngine(); $frame = $engine->getParser()->getPreprocessor()->newFrame(); @@ -514,7 +514,7 @@ $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 @@ /** * @dataProvider provideVolatileCaching */ - function testVolatileCaching( $func ) { + public function testVolatileCaching( $func ) { $engine = $this->getEngine(); $parser = $engine->getParser(); $pp = $parser->getPreprocessor(); @@ -626,7 +626,7 @@ $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 @@ ); } - function testGetCurrentFrameAndMWLoadData() { + public function testGetCurrentFrameAndMWLoadData() { $engine = $this->getEngine(); $parser = $engine->getParser(); $pp = $parser->getPreprocessor(); @@ -654,7 +654,7 @@ $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(); diff --git a/tests/engines/LuaCommon/LanguageLibraryTest.php b/tests/engines/LuaCommon/LanguageLibraryTest.php index 144a867..d7ec9f0 100644 --- a/tests/engines/LuaCommon/LanguageLibraryTest.php +++ b/tests/engines/LuaCommon/LanguageLibraryTest.php @@ -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 @@ } } - function getTestModules() { + protected function getTestModules() { return parent::getTestModules() + array( 'LanguageLibraryTests' => __DIR__ . '/LanguageLibraryTests.lua', ); } - function testFormatDateTTLs() { + public function testFormatDateTTLs() { global $wgContLang; $engine = $this->getEngine(); diff --git a/tests/engines/LuaCommon/LuaEngineTestBase.php b/tests/engines/LuaCommon/LuaEngineTestBase.php index 54fec2c..4454b57 100644 --- a/tests/engines/LuaCommon/LuaEngineTestBase.php +++ b/tests/engines/LuaCommon/LuaEngineTestBase.php @@ -54,7 +54,7 @@ */ 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; } diff --git a/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php b/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php index 6921cf5..9e0f7c4 100644 --- a/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php +++ b/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php @@ -21,7 +21,7 @@ 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 @@ 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 ); diff --git a/tests/engines/LuaCommon/LuaInterpreterTest.php b/tests/engines/LuaCommon/LuaInterpreterTest.php index a7add81..57ea5b6 100644 --- a/tests/engines/LuaCommon/LuaInterpreterTest.php +++ b/tests/engines/LuaCommon/LuaInterpreterTest.php @@ -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 @@ } } - function getBusyLoop( $interpreter ) { + protected function getBusyLoop( $interpreter ) { $chunk = $interpreter->loadString( ' local args = {...} local x, i @@ -25,12 +25,8 @@ 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 @@ } /** @dataProvider provideRoundtrip */ - function testDoubleRoundtrip( /* ... */ ) { + public function testDoubleRoundtrip( /* ... */ ) { $args = func_get_args(); $args = $this->normalizeOrder( $args ); @@ -64,7 +60,7 @@ * 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 @@ $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 @@ 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 @@ * @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 @@ * @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 @@ $interpreter->callFunction( $chunk ); } - function testWrapPHPFunction() { + public function testWrapPHPFunction() { $interpreter = $this->newInterpreter(); $func = $interpreter->wrapPhpFunction( function ( $n ) { return array( 42, $n ); @@ -162,4 +158,3 @@ $this->assertEquals( array( 42, 'From Lua' ), $res ); } } - diff --git a/tests/engines/LuaCommon/MessageLibraryTest.php b/tests/engines/LuaCommon/MessageLibraryTest.php index 604c977..ba8f3c3 100644 --- a/tests/engines/LuaCommon/MessageLibraryTest.php +++ b/tests/engines/LuaCommon/MessageLibraryTest.php @@ -3,7 +3,7 @@ class Scribunto_LuaMessageLibraryTests extends Scribunto_LuaEngineTestBase { protected static $moduleName = 'MessageLibraryTests'; - function getTestModules() { + public function getTestModules() { return parent::getTestModules() + array( 'MessageLibraryTests' => __DIR__ . '/MessageLibraryTests.lua', ); diff --git a/tests/engines/LuaCommon/TitleLibraryTest.php b/tests/engines/LuaCommon/TitleLibraryTest.php index 8eea3f7..281cc28 100644 --- a/tests/engines/LuaCommon/TitleLibraryTest.php +++ b/tests/engines/LuaCommon/TitleLibraryTest.php @@ -115,7 +115,7 @@ ); } - function testAddsLinks() { + public function testAddsLinks() { $engine = $this->getEngine(); $interpreter = $engine->getInterpreter(); diff --git a/tests/engines/LuaCommon/UstringLibraryTest.php b/tests/engines/LuaCommon/UstringLibraryTest.php index b0131ce..5a71a01 100644 --- a/tests/engines/LuaCommon/UstringLibraryTest.php +++ b/tests/engines/LuaCommon/UstringLibraryTest.php @@ -20,7 +20,7 @@ ); } - function testUstringLibraryNormalizationTestsAvailable() { + public function testUstringLibraryNormalizationTestsAvailable() { if ( UstringLibraryNormalizationTestProvider::available( $err ) ) { $this->assertTrue( true ); } else { @@ -28,7 +28,7 @@ } } - function provideUstringLibraryNormalizationTests() { + public function provideUstringLibraryNormalizationTests() { if ( !$this->normalizationDataProvider ) { $this->normalizationDataProvider = new UstringLibraryNormalizationTestProvider( $this->getEngine() ); } @@ -38,7 +38,7 @@ /** * @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 ); diff --git a/tests/engines/LuaSandbox/LuaSandboxInterpreterTest.php b/tests/engines/LuaSandbox/LuaSandboxInterpreterTest.php index 84ece34..0234a09 100644 --- a/tests/engines/LuaSandbox/LuaSandboxInterpreterTest.php +++ b/tests/engines/LuaSandbox/LuaSandboxInterpreterTest.php @@ -13,13 +13,13 @@ '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 ); diff --git a/tests/engines/LuaSandbox/SandboxTest.php b/tests/engines/LuaSandbox/SandboxTest.php index d1bc5da..a5d2ba6 100644 --- a/tests/engines/LuaSandbox/SandboxTest.php +++ b/tests/engines/LuaSandbox/SandboxTest.php @@ -7,13 +7,13 @@ 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" ); diff --git a/tests/engines/LuaStandalone/LuaStandaloneInterpreterTest.php b/tests/engines/LuaStandalone/LuaStandaloneInterpreterTest.php index 9d4f072..a10af30 100644 --- a/tests/engines/LuaStandalone/LuaStandaloneInterpreterTest.php +++ b/tests/engines/LuaStandalone/LuaStandaloneInterpreterTest.php @@ -15,18 +15,18 @@ '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 @@ $this->assertEquals( $vsize, $status['vsize'], 'vsize', $vsize * 0.1 ); } - function testFreeFunctions() { + public function testFreeFunctions() { $interpreter = $this->newInterpreter(); // Test #1: Make sure freeing actually works -- To view, visit https://gerrit.wikimedia.org/r/172691 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I270d1dd9b6545e15398c2f8b8e9ae533844cc998 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Scribunto Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits