public function routerShutdown(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) { if ($request->controller == 'Api') { require \Yaf\Registry::get('config')->application->phpwind->wekit_bin; Wekit::init('phpwind'); $application = Wind::application('phpwind', Wekit::S()); } }
private function provideApp() { $_SERVER['SCRIPT_FILENAME'] = "index.php"; $_SERVER['SCRIPT_NAME'] = 'index.php'; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=noPrint'; Wind::application("long", array('web-apps' => array('long' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest'))))))->run(); }
/** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); require_once 'base\\WindFactory.php'; require_once 'data\\ForWindFactoryTest.php'; Wind::application()->createApplication(); $this->factory || ($this->factory = Wind::getApp()->getWindFactory()); }
/** * 运行当前应用 * * @param string $name 应用名称默认‘phpwind’ * @param array $components 组建配置信息 该组建配置将会覆盖原组建配置,默认为空 */ public static function run($name = 'phpwind', $components = array()) { self::init($name); if (!empty($components)) self::$_sc['components'] = (array)$components + self::$_sc['components']; /* @var $application WindWebFrontController */ $application = Wind::application($name, self::$_sc); $application->registeFilter(new PwFrontFilters($application)); $application->run(); }
/** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); require_once 'web\\WindWebApplication.php'; require_once 'web\\WindForward.php'; require_once 'base\\WindFactory.php'; require_once 'data\\ForWindFactoryTest.php'; $this->front = Wind::application("long", array('web-apps' => array('long' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest')))))); }
/** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); require_once 'base\\WindModule.php'; require_once 'data\\TestFrontController.php'; require_once 'data\\ForWindFactoryTest.php'; require_once 'data\\LongController.php'; Wind::application()->createApplication(); $this->WindModule = new LongController(); }
/** * 运行当前应用 * * @param string $name 应用名称默认‘phpwind’ * @param array $components 组建配置信息 该组建配置将会覆盖原组建配置,默认为空 */ public static function run($name = 'phpwind', $components = array()) { $config = WindUtility::mergeArray(include WEKIT_PATH . '../conf/application/default.php', include WEKIT_PATH . '../conf/application/' . $name . '.php'); if (!empty($components)) { $config['components'] = (array) $components + $config['components']; } /* @var $application WindWebFrontController */ $application = Wind::application($name, $config); $application->registeFilter(new PwFrontFilters($application)); $application->run(); }
public function testFormFilter() { $_SERVER['SCRIPT_FILENAME'] = "index.php"; $_SERVER['SCRIPT_NAME'] = 'index.php'; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=test'; $_POST['shi'] = 'shi'; $_POST['long'] = 'long'; Wind::application('EnableValidata', $this->getConfigData())->run(); $testForm = Wind::getApp()->getRequest()->getAttribute("testForm"); $this->assertEquals("shi", $testForm->getShi()); $this->assertEquals("long", $testForm->getLong()); }
/** * Tests WindDispatcher->dispatch() */ public function testDispatch() { $_SERVER['SCRIPT_FILENAME'] = "index.php"; $_SERVER['SCRIPT_NAME'] = 'index.php'; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=noPrint'; $front = Wind::application('long', array('web-apps' => array('long' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest'))))))->run(); $forward = new WindForward(); $forward->setIsReAction(true); $forward->setAction('/long/test'); ob_start(); Wind::getApp()->doDispatch($forward); $this->assertEquals(ob_get_clean(), 'LongController-test'); }
public function testErrorHandler() { $front = Wind::application("WindError", array('web-apps' => array('WindError' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest', 'compile-dir' => 'data')))))); $_SERVER['SCRIPT_FILENAME'] = "index.php"; $_SERVER['SCRIPT_NAME'] = 'index.php'; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?a=shi&c=long'; try { $front->run(); } catch (Exception $e) { $this->assertEquals("error handled", $e->getMessage()); return; } $this->fail("Error Handler Test Error"); }
/** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); $this->WindFrontController = Wind::application("long", array('web-apps' => array('long' => $this->appConfigData()))); }
<?php error_reporting(0); @header("Content-Type:text/html; charset=utf-8"); define('SCR', 'aCloud_index'); define('WIND_DEBUG', 0); require_once '.././src/wekit.php'; $front = Wind::application('acloud', WEKIT_PATH . 'aCloud/aCloudConfig.php'); // $front->createApplication(); Wekit::createapp('acloud'); $config = (include WEKIT_PATH . '../conf/application/default.php'); Wekit::app()->charset = $config['web-apps']['default']['charset']; require_once WEKIT_PATH . 'aCloud/aCloud.php'; $router = new ACloudRouter(); $router->run();
<?php error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); require './src/wekit.php'; /* @var $application WindWebFrontController */ Wind::application('install', WindUtility::mergeArray(include WEKIT_PATH . '../conf/application/default.php', include WEKIT_PATH . '../conf/application/install.php'))->run();
public function testResolveActionFilter() { require_once 'data/Listener.php'; Wind::application()->createApplication(); $errorMessage = new WindErrorMessage("shi"); $this->testController->setErrorMessage($errorMessage); $forward = new WindForward(); $forward->setAction("long"); $this->testController->setForward($forward); $_GET['name'] = 'shilong'; $this->testController->setGlobal('shilong', 'name'); $forward->setVars('name', 'xxxxx'); $_GET['wuq'] = 'wuq'; $this->testController->resolveActionFilter($this->dataForResolveActionFilter()); $this->assertEquals("post_post_post_pre_pre_pre_shi", $errorMessage->getError(0)); $this->assertEquals("post_post_post_pre_pre_pre_long", $forward->getAction()); }
<?php error_reporting(E_ALL); //define('WIND_DEBUG', 0); require_once '../../wind/Wind.php'; Wind::application()->run();
<?php error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); define('WIND_DEBUG', 1); require_once '../../wind/Wind.php'; Wind::application('blog', 'conf/config.php')->run();
<?php /** * @author Shi Long <*****@*****.**> * @link http://www.phpwind.com * @copyright Copyright © 2003-2010 phpwind.com * @license */ error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); require_once dirname(dirname(__DIR__)) . '/wind/Wind.php'; Wind::register(dirname(dirname(__DIR__)), 'PROJ'); Wind::application('web', __DIR__ . '/conf/config.php')->run();
<?php !defined('WINDID') && define('WINDID', dirname(__FILE__)); !defined('WINDID_PATH') && define('WINDID_PATH', WINDID); !defined('WINDID_VERSION') && define('WINDID_VERSION', '0.0.2'); if (!defined('WEKIT_VERSION')) { require_once WINDID . '/../../wind/Wind.php'; $database = (include WINDID . '/conf/database.php'); Wind::register(WINDID, 'WINDID'); Wind::application(); Wind::import('WINDID:library.Windid'); $component = array('path' => 'WIND:db.WindConnection', 'config' => $database); Wind::registeComponent($component, 'windiddb', 'singleton'); } class WindidApi { public static function api($api) { static $cls = array(); $array = array('user', 'config', 'message', 'avatar', 'area', 'school'); if (!in_array($api, $array)) { return WindidError::FAIL; } $class = 'Windid' . ucfirst($api) . 'Api'; if (!isset($cls[$class])) { if (Windid::client()->clientDb == 'mysql') { $class = Wind::import('WINDID:api.local.' . $class); $cls[$class] = new $class(); } elseif (Windid::client()->clientDb == 'http') { $class = Wind::import('WINDID:api.web.' . $class); $cls[$class] = new $class();
<?php if (!defined('WEKIT_VERSION')) { error_reporting(E_ERROR | E_PARSE); require_once WINDID_BOOT . '../wekit.php'; Wekit::init('windidclient'); Wind::application('windidclient', Wekit::S()); $database = (include WINDID_BOOT . 'conf/database.php'); $windidConfig = (include Wind::getRealPath('WINDID:conf.config.php', true)); Wind::register(WINDID_PATH . 'service', 'SRV'); } else { $windidConfig = Wekit::C('windid'); if ($windidConfig['windid'] == 'local') { $database = Wind::getComponent('db')->getConfig(); $database['tableprefix'] .= 'windid_'; $windidConfig['connect'] = 'db'; } else { $database = array('dsn' => 'mysql:host=' . $windidConfig['db.host'] . ';dbname=' . $windidConfig['db.name'] . ';port=' . $windidConfig['db.port'], 'user' => $windidConfig['db.user'], 'pwd' => $windidConfig['db.pwd'], 'charset' => $windidConfig['db.charset'], 'tableprefix' => $windidConfig['db.prefix']); } $windidConfig['charset'] = Wekit::V('charset'); } Wind::register(WINDID_PATH . 'service', 'WSRV'); Wind::import('WSRV:base.WindidBaseDao'); Wind::import('WSRV:base.WindidUtility'); Wind::import('WSRV:base.WindidError'); Wind::registeComponent(array('path' => 'WIND:db.WindConnection', 'config' => $database), 'windiddb', 'singleton'); define('WINDID_CONNECT', $windidConfig['connect']); define('WINDID_SERVER_URL', $windidConfig['serverUrl']); define('WINDID_CLIENT_ID', $windidConfig['clientId']); define('WINDID_CLIENT_KEY', $windidConfig['clientKey']); define('WINDID_CLIENT_CHARSET', $windidConfig['charset']);