public function runGeneratorCommand($command) { ob_start(); $Generator = new AkelosGenerator(); $Generator->setFileOptions(array('base_path' => AK_FRAMEWORK_DIR)); $Generator->runCommand($command); $result = ob_get_clean(); //AK::trace($result); return $result; }
public function test_service_generator() { $TodoApi = new TodoApi(); ob_start(); $Generator = new AkelosGenerator(); $Generator->runCommand('service Todo'); ob_end_clean(); require_once AkConfig::getDir('models') . DS . 'todo_service.php'; $TodoService = new TodoService(); foreach (array_keys($TodoApi->getApiMethods()) as $method) { $this->assertTrue(method_exists($TodoService, $method)); } }
function test_service_generator() { $TodoApi =& new TodoApi(); ob_start(); require_once(AK_LIB_DIR.DS.'utils'.DS.'generators'.DS.'AkelosGenerator.php'); $Generator = new AkelosGenerator(); $Generator->runCommand('service Todo'); ob_end_clean(); require_once(AK_MODELS_DIR.DS.'todo_service.php'); $TodoService =& new TodoService(); foreach (array_keys($TodoApi->getApiMethods()) as $method){ $this->assertTrue(method_exists($TodoService, $method)); } }
// +----------------------------------------------------------------------+ // | Akelos Framework - http://www.akelos.org | // +----------------------------------------------------------------------+ // | Copyright (c) 2002-2006, Akelos Media, S.L. & Bermi Ferrer Martinez | // | Released under the GNU Lesser General Public License, see LICENSE.txt| // +----------------------------------------------------------------------+ /** * @package AkelosFramework * @subpackage Generators * @author Bermi Ferrer <bermi a.t akelos c.om> * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html> */ error_reporting(defined('AK_ERROR_REPORTING_ON_SCRIPTS') ? AK_ERROR_REPORTING_ON_SCRIPTS : 0); require_once(AK_LIB_DIR.DS.'Ak.php'); require_once(AK_LIB_DIR.DS.'AkObject.php'); require_once(AK_LIB_DIR.DS.'AkInflector.php'); defined('AK_SKIP_DB_CONNECTION') && AK_SKIP_DB_CONNECTION ? ($dsn='') : Ak::db(&$dsn); array_shift($argv); $command = join(' ',$argv); require_once(AK_LIB_DIR.DS.'utils'.DS.'generators'.DS.'AkelosGenerator.php'); $Generator = new AkelosGenerator(); $Generator->runCommand($command); echo "\n"; ?>