1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
<?php
class PhpTestModule {
public static function getModuleInfo() {
return Grt::getModuleInfoXml('PhpTestModule', '');
}
public static function helloWorld() {
Grt::getInstance()->addMsg("Hello world!");
return 'Hello world!';
}
public static function upperCase($str) {
return strtoupper($str);
}
public static function getListSize(GrtList $list) {
return $list->size();
}
public static function concatStrings($s1, $s2) {
return $s1 . $s2;
}
public static function throwException() {
throw new Exception("Exception Test");
}
public static function getMessages() {
$msgList = new GrtList("GrtMessage", "");
$msgs = Grt::getInstance()->getMessages();
for ($i = 0; $i < count($msgs); $i++) {
$msgList->addObject($msgs[$i]);
}
Grt::getInstance()->clearMessages();
return $msgList;
}
public static function getGlobalString($objectPath) {
Grt::getInstance()->addMsg("Calling getGrtGlobalAsString.");
Grt::getInstance()->addMsgDetailToLastMsg(
"applicationPath = " . Grt::getInstance()->getApplicationPath());
Grt::getInstance()->addMsgDetailToLastMsg(
"callback.class = "
. get_class(Grt::getInstance()->getCallback()));
return Grt::getInstance()->getGrtGlobalAsString($objectPath);
}
public static function testCallbacks() {
$root = Grt::getInstance()->getGrtGlobalAsObject("/");
$list = new GrtStringList("", "");
$list->add("Item1");
$list->add("Item2");
$root->addObject("stringList", $list);
$obj = new com_mysql_grt_GrtObject(null);
$obj->setName("testObject");
$root->addObject("object", $obj);
$map = new GrtStringHashMap("", "");
$map->add("mike", "mzinner@mysql.com");
$map->add("alfredo", "alfredo@mysql.com");
$root->addObject("emails", $map);
$catalog = new com_mysql_grt_db_Catalog(null);
$catalog->setName("sourceCatalog");
$schemata = new GrtObjectList("com_mysql_grt_db_Schema", "");
$catalog->setSchemata($schemata);
$schema = new com_mysql_grt_db_Schema($catalog);
$schema->setName("scott");
$schemata->add($schema);
$root->addObject("sourceCatalog", $catalog);
}
public static function printPhpInfo() {
phpinfo();
}
public static function debugTest() {
echo xdebug_call_file() . ", func: " . xdebug_call_function() . ", Ln" . xdebug_call_line();
xdebug_break();
}
}
?>
|