本文整理匯總了PHP中OX_Component::callStaticMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP OX_Component::callStaticMethod方法的具體用法?PHP OX_Component::callStaticMethod怎麽用?PHP OX_Component::callStaticMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OX_Component
的用法示例。
在下文中一共展示了OX_Component::callStaticMethod方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test_callStaticMethod
function test_callStaticMethod()
{
$this->assertEqual(OX_Component::callStaticMethod('testExtension1', 'testGroup1', 'testComponent1', 'staticMethod'), 'staticMethodResult1');
$this->assertEqual(OX_Component::callStaticMethod('testExtension1', 'testGroup1', 'testComponent1', 'staticMethodWithParams', 'foo'), 'staticMethodWithParams1=foo');
}
示例2: testCallStaticMethod
/**
* A method to test the callStaticMethod() method.
*/
function testCallStaticMethod()
{
// Set the error handling class' handleErrors() method as
// the error handler for PHP for this test.
$oTestErrorHandler = new TestErrorHandler();
PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$oTestErrorHandler, 'handleErrors'));
// Test with a bad module/package
$return = MAX_Plugin::callStaticMethod('foo', 'bar', null, 'foo');
$this->assertEqual(count($oTestErrorHandler->aErrors), 1);
$this->assertEqual($oTestErrorHandler->aErrors[0]->message, 'Unable to include the file ' . MAX_PATH . '/plugins/foo/bar/bar' . MAX_PLUGINS_EXTENSION . '.');
$this->assertFalse($result);
$oTestErrorHandler->reset();
// Unset the error handler
PEAR::popErrorHandling();
// Set the error handling class' handleErrors() method as
// the error handler for PHP for this test.
$oTestErrorHandler = new TestErrorHandler();
PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$oTestErrorHandler, 'handleErrors'));
// Test with a bad method
$return = MAX_Plugin::callStaticMethod('reports', 'standard', 'advertisingAnalysisReport', 'foo');
$this->assertEqual(count($oTestErrorHandler->aErrors), 1);
$this->assertEqual($oTestErrorHandler->aErrors[0]->message, "Method 'foo()' not defined in class 'Plugins_Reports_Standard_AdvertisingAnalysisReport'.");
$this->assertFalse($result);
$oTestErrorHandler->reset();
// Unset the error handler
PEAR::popErrorHandling();
unset($GLOBALS['_MAX']['CONF']['plugins']['openXTests']);
unset($GLOBALS['_MAX']['CONF']['pluginGroupComponents']['Dummy']);
TestEnv::installPluginPackage('openXTests');
// Test with a real method, no parameters
$return = OX_Component::callStaticMethod('deliveryLimitations', 'Dummy', 'Dummy', 'isAllowed');
$this->assertTrue($return);
// Test with a real method, with parameters
$return = OX_Component::callStaticMethod('deliveryLimitations', 'Dummy', 'Dummy', 'isAllowed', 'disallow');
$this->assertFalse($return);
TestEnv::uninstallPluginPackage('openXTests');
}