Exemplo n.º 1
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->basePath = $basePath = realpath(__DIR__ . '/../../../../../');
     $appPath = $basePath . '/app';
     $this->confPath = $confPath = $appPath . '/boxdata/conf';
     $this->etcPath = $etcPath = $appPath . '/boxdata/etc/local';
     $this->object = BoxRouteInstance::getInstance(new BoxRouteConf($etcPath, null));
 }
Exemplo n.º 2
0
 * @project appbox
 * @package
 * @author nickfan<*****@*****.**>
 * @link http://www.axiong.me
 * @version $Id$
 * @lastmodified: 2014-06-05 14:38
 *
 */
require_once __DIR__ . '/../../../../bootstrap/initenv.php';
use Nickfan\AppBox\Common\BoxConstants;
use Nickfan\AppBox\Common\Usercache\ApcBoxUsercache;
use Nickfan\AppBox\Config\BoxRouteConf;
use Nickfan\AppBox\Instance\BoxRouteInstance;
use Nickfan\AppBox\Service\Drivers\CfgBoxRouteServiceDriver;
use Nickfan\AppBox\Service\Drivers\RedisBoxRouteServiceDriver;
$instBoxRouteInstance = BoxRouteInstance::getInstance(new BoxRouteConf($boxapp['path.storage'] . '/etc/local', new ApcBoxUsercache()));
$cfgService = CfgBoxRouteServiceDriver::factory($instBoxRouteInstance);
// \Nickfan\AppBox\Support\Facades\AppBox::debug(true,$cfgService);  //exit; // [DEV-DEBUG]---
$key = 'dsn';
$optionEg1 = array('routeKey' => 'root');
$optionEg2 = array('routeKey' => 'mygroup', 'routeMode' => BoxConstants::DATAROUTE_MODE_ATTR, 'routeAttr' => array('id' => 3));
$optionEg3 = array('routeMode' => BoxConstants::DATAROUTE_MODE_IDSET, 'routeIdSet' => array('routeKey' => 'mygroup', 'group' => 'g1'));
$optionEg4 = array('routeMode' => BoxConstants::DATAROUTE_MODE_DIRECT, 'routeSettings' => array('dsn' => 'ftp://*****:*****@myhost/mypath?arg1=v1&arg2=v2#anchor1=a1&anchor2=a2', 'timeout' => 30, 'settings' => ''));
$data1 = $cfgService->getByKey($key, $optionEg1);
var_dump($data1);
$data2 = $cfgService->getByKey($key, $optionEg2);
var_dump($data2);
$data3 = $cfgService->getByKey($key, $optionEg3);
var_dump($data3);
$data4 = $cfgService->getByKey($key, $optionEg4);
var_dump($data4);
Exemplo n.º 3
0
        | Register Facade Aliases To Full Classes
        |--------------------------------------------------------------------------
        |
        | By default, we use short keys in the container for each of the core
        | pieces of the framework. Here we will register the aliases for a
        | list of all of the fully qualified class names making DI easy.
        |
        */
        $boxapp->registerCoreContainerAliases();
        //$userCacheObject = new AutoBoxUsercache();
        $userCacheObject = $boxapp->makeUserCacheInstance();
        $boxapp->instance('usercache', $userCacheObject);
        $boxapp->instance('boxdict', $dict = new BoxDictionary(array()));
        $boxapp->instance('boxconf', $config = new BoxRepository($boxapp['path.storage'] . '/conf', $userCacheObject));
        $boxapp->instance('boxrouteconf', $routeconf = new BoxRouteConf($boxapp['path.storage'] . '/etc/local', $userCacheObject));
        $boxapp->instance('boxrouteinst', $routeinstance = BoxRouteInstance::getInstance($routeconf));
        date_default_timezone_set($boxapp['boxconf']['app']['timezone']);
        /*
        |--------------------------------------------------------------------------
        | Register The Alias Loader
        |--------------------------------------------------------------------------
        |
        | The alias loader is responsible for lazy loading the class aliases setup
        | for the application. We will only register it if the "config" service
        | is bound in the application since it contains the alias definitions.
        |
        */
        AliasLoader::getInstance($boxapp['boxconf']['app']['aliases'])->register();
    }
    return $boxapp;
}));
Exemplo n.º 4
0
 public function registerBoxRouteInst()
 {
     $this->app->singleton('boxrouteinst', function ($app) {
         $path_base = $this->getPathBase();
         return \Nickfan\AppBox\Instance\BoxRouteInstance::getInstance($app->make('boxrouteconf'));
     });
     // Shortcut so developers don't need to add an Alias in app/config/app.php
     $this->app->booting(function () {
         $loader = \Illuminate\Foundation\AliasLoader::getInstance();
         $loader->alias('BoxRouteInst', 'Nickfan\\AppBox\\Embed\\Laravel\\Facades\\BoxRouteInst');
     });
 }