/**
  * @param Itk_PgmAbstract $program
  * @return Itk_Pgm_Result
  */
 public function execute(Itk_PgmAbstract $program)
 {
     $prog = i5_program_prepare($program->getProgramName(), $program->getDescription());
     if ($prog === false) {
         throw new Itk_Connection_Adapter_Exception('Unable to prepare program: ' . i5_errormsg());
     }
     $returnValues = $program->getReturn();
     if (!i5_program_call($prog, $program->toArray(), $returnValues)) {
         throw new Itk_Connection_Adapter_Exception('Unable to execute program: ' . i5_errormsg());
     }
     $results = array();
     foreach ($returnValues as $var) {
         $results[$var] = ${$var};
     }
     return new Itk_Pgm_Result($results);
 }
 public function testExecuteProgramWithDefaultAdapter()
 {
     $mgr = new Itk_Connection_Manager(array('adapter' => 'Mock', 'programDir' => dirname(__FILE__) . '/testdata/programs'));
     Itk_PgmAbstract::setDefaultAdapter($mgr->getAdapter());
     $mockTest = new Test_Mock();
     $mockTest->PROD_ID = 'xyz101';
     $mockTest->STORE_LOC = 'a1001';
     $mockTest->PRICE = 0;
     $res = $mockTest->execute();
     $this->assertType('Itk_Pgm_Result', $res);
     $this->assertEquals($res->AMOUNT, 10.99);
 }
 public function testCommonPgm()
 {
     if (!function_exists('i5_connect')) {
         $this->markTestIncomplete('This test must be run on an i5 system');
         return;
     }
     $mgr = new Itk_Connection_Manager(array('adapter' => 'Live', 'username' => '', 'password' => '', 'host' => '127.0.0.1'));
     Itk_PgmAbstract::setDefaultAdapter($mgr->getAdapter());
     $m = new Test_CommonPgm();
     $m->CODE = 2;
     $res = $m->execute();
     $this->assertEquals('Zend', $res->DESC);
 }
<td><input name="code" type="text"></td>

<th align="right">(Valid Code is 1 or 2)</th>
</tr>

<tr>
<td colspan="2" align="right"><input type="reset"> <input value="Call 
program" type="submit"></td>
</tr>

</tbody></table>
</form>
</center>
</body></html>
	<?php 
    exit;
}
?>
#Valid code value is 1 or 2.

<?php 
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../library'));
require_once 'models/CommonPgm.php';
$mgr = new Itk_Connection_Manager(array('adapter' => 'Live', 'username' => '', 'password' => '', 'host' => '127.0.0.1'));
Itk_PgmAbstract::setDefaultAdapter($mgr->getAdapter());
$model = new Model_CommonPgm();
$model->CODE = $_POST['code'];
$result = $model->execute();
echo "The return values are: <br>", "Code: ", $result->CODE, "<br> Description: ", $result->DESC, "<br>";
 public static function setDefaultAdapter(Itk_Connection_AdapterAbstract $adapter)
 {
     self::$_defaultAdapter = $adapter;
 }
 public function setup()
 {
     $this->_mgr = new Itk_Connection_Manager(array('adapter' => 'Mock', 'programDir' => dirname(__FILE__) . '/testdata/programs'));
     Itk_PgmAbstract::setDefaultAdapter($this->_mgr->getAdapter());
     parent::setup();
 }