/** * @runaInSeparateProcess */ public function testCase027() { $globalDir = '/php/global/dir'; if (!defined('YAF_MODE')) { Yaf_G::iniSet('yaf.library', $globalDir); Yaf_G::iniSet('yaf.use_spl_autoload', false); } else { ini_set('yaf.library', $globalDir); ini_set('yaf.use_spl_autoload', false); } $config = array("application" => array("directory" => TEST_APPLICATION_PATH . 'application/', "dispatcher" => array("catchException" => 0, "throwException" => 0))); $app = new Yaf_Application($config); include dirname(__FILE__) . '/Loader/testCase027.php'; try { $app->execute('testCase027'); } catch (PHPUnit_Framework_Error_Warning $e) { $this->assertContains('Could not find script ' . TEST_APPLICATION_PATH . 'application/controllers/NoExists.php', $e->getMessage()); } }
<?php /************************************************************************** File Name: cache_list.php Author: liukai Created Time: Mon 24 Aug 2015 02:05:20 PM CST **************************************************************************/ //yaf 使用命令行方式 //可以直接使用model,完成autoload define('APPLICATION_PATH', dirname(dirname(__FILE__))); $app = new Yaf_Application(APPLICATION_PATH . "/conf/application.ini"); //把配置保存起来 $arrConfig = Yaf_Application::app()->getConfig(); Yaf_Registry::set('config', $arrConfig); $app->execute('main'); function main() { echo "running"; }