Exemple #1
0
 function testCallUserFuncWorkarounds()
 {
     $this->assertEquals(call_user_func(array('MWFunctionTest', 'someMethod')), MWFunction::call('MWFunctionTest::someMethod'));
     $this->assertEquals(call_user_func(array('MWFunctionTest', 'someMethod'), 'foo', 'bar', 'baz'), MWFunction::call('MWFunctionTest::someMethod', 'foo', 'bar', 'baz'));
     $this->assertEquals(call_user_func_array(array('MWFunctionTest', 'someMethod'), array()), MWFunction::callArray('MWFunctionTest::someMethod', array()));
     $this->assertEquals(call_user_func_array(array('MWFunctionTest', 'someMethod'), array('foo', 'bar', 'baz')), MWFunction::callArray('MWFunctionTest::someMethod', array('foo', 'bar', 'baz')));
 }
/**
 * This function accepts multiple message keys and returns a message instance
 * for the first message which is non-empty. If all messages are empty then an
 * instance of the first message key is returned.
 * @param varargs: message keys
 * @return Message
 * @since 1.18
 */
function wfMessageFallback()
{
    $args = func_get_args();
    return MWFunction::callArray('Message::newFallbackSequence', $args);
}
Exemple #3
0
 function testFallbackMbstringFunctions()
 {
     if (!extension_loaded('mbstring')) {
         $this->markTestSkipped("The mb_string functions must be installed to test the fallback functions");
     }
     $sampleUTF = "Östergötland_coat_of_arms.png";
     //mb_substr
     $substr_params = array(array(0, 0), array(5, -4), array(33), array(100, -5), array(-8, 10), array(1, 1), array(2, -1));
     foreach ($substr_params as $param_set) {
         $old_param_set = $param_set;
         array_unshift($param_set, $sampleUTF);
         $this->assertEquals(MWFunction::callArray('mb_substr', $param_set), MWFunction::callArray('Fallback::mb_substr', $param_set), 'Fallback mb_substr with params ' . implode(', ', $old_param_set));
     }
     //mb_strlen
     $this->assertEquals(mb_strlen($sampleUTF), Fallback::mb_strlen($sampleUTF), 'Fallback mb_strlen');
     //mb_str(r?)pos
     $strpos_params = array();
     foreach ($strpos_params as $param_set) {
         $old_param_set = $param_set;
         array_unshift($param_set, $sampleUTF);
         $this->assertEquals(MWFunction::callArray('mb_strpos', $param_set), MWFunction::callArray('Fallback::mb_strpos', $param_set), 'Fallback mb_strpos with params ' . implode(', ', $old_param_set));
         $this->assertEquals(MWFunction::callArray('mb_strrpos', $param_set), MWFunction::callArray('Fallback::mb_strrpos', $param_set), 'Fallback mb_strrpos with params ' . implode(', ', $old_param_set));
     }
 }