Public Member Functions | |
doTest () | |
testExec () | |
testSshExec () |
Definition at line 8 of file UTShellCmd.class.php.
UTShellCmd::doTest | ( | ) |
Definition at line 10 of file UTShellCmd.class.php.
References testExec().
00011 { 00012 $this->testExec(); 00013 // Hard to create general unit test for ssh functions 00014 // $this->testSshExec(); 00015 }
UTShellCmd::testExec | ( | ) |
Definition at line 17 of file UTShellCmd.class.php.
References ShellCmd::exec().
Referenced by doTest().
00018 { 00019 $this->setSectionLabel('exec'); 00020 00021 try 00022 { 00023 eval($this->needEqual('ShellCmd::exec("uname")', '"Linux\n"')); 00024 eval($this->needEqual('ShellCmd::exec("uptime | wc -l")', '"1\n"')); 00025 eval($this->needEqual('ShellCmd::exec("wc", "I may be synthetic, but I\'m not stupid.\n\n")', '" 2 8 41\n"')); 00026 } 00027 catch (Exception $e) 00028 { 00029 eval($this->needEmpty('$e->getMessage()')); 00030 } 00031 00032 try 00033 { 00034 ShellCmd::exec("ls -2"); 00035 } 00036 catch (Exception $e) 00037 { 00038 eval($this->needEqual('$e->getMessage()', '"ls: invalid option -- \'2\'\nTry `ls --help\' for more information.\n Exit code: 2"')); 00039 } 00040 }
UTShellCmd::testSshExec | ( | ) |
Definition at line 42 of file UTShellCmd.class.php.
References ShellCmd::sshExec().
00043 { 00044 $this->setSectionLabel('sshExec'); 00045 00046 try 00047 { 00048 eval($this->needEqual('ShellCmd::sshExec("arlukin@localhost", "uname")', '"Linux\n"')); 00049 eval($this->needEqual('ShellCmd::sshExec("arlukin@localhost", "uptime | wc -l")', '"1\n"')); 00050 eval($this->needEqual('ShellCmd::sshExec("arlukin@localhost", "wc", "I may be synthetic, but I\'m not stupid.\n\n")', '" 2 8 41\n"')); 00051 } 00052 catch (Exception $e) 00053 { 00054 eval($this->needEmpty('$e->getMessage()')); 00055 } 00056 00057 try 00058 { 00059 ShellCmd::sshExec("arlukin@localhost", "ls -2"); 00060 } 00061 catch (Exception $e) 00062 { 00063 eval($this->needEqual('$e->getMessage()', '"ls: invalid option -- \'2\'\nTry `ls --help\' for more information.\n Exit code: 2"')); 00064 } 00065 }