public function testGroupInRequest() { Config::group('groupInRequest')->doesCommand('blarg')->whichInvokes('BlargClass'); $cfg = Config::request('myRequest')->doesCommand('blork')->whichInvokes('BlorkClass')->usesGroup('groupInRequest')->doesCommand('last')->whichInvokes('LastClass')->getConfiguration(); $expects = array('blork', 'blarg', 'last'); $i = 0; foreach ($cfg[Config::REQUESTS]['myRequest'] as $command => $params) { $this->assertEquals($expects[$i++], $command); } }
public static function conn($name = null) { if (is_null($name)) { $keys = array_keys(Config::group("databases")); if (count($keys) > 0) { $name = $keys[0]; } } if (!isset(static::$connections[$name])) { $config = Config::item("databases", $name); switch ($config["type"]) { case "mysql": include_once J_SYSTEMPATH . "database" . DS . "mysql" . DS . "MysqlDB" . EXT; include_once J_SYSTEMPATH . "database" . DS . "mysql" . DS . "MysqlRecordSet" . EXT; static::$connections[$name] = new MysqlDB($config); break; default: trigger_error("Database type <b>'" . $config["type"] . "'</b> not suported."); break; } } return static::$connections[$name]; }
public function testGroup() { $result = array('cool' => '11011100101', 'nice' => array('stuff' => 3.1416)); Config::load(array('data' => $result)); $this->assertEquals($result, Config::group('data')); }
* @code * <?php * Config::group('bootstrap') * ->doesCommand('some_command') * ->whichInvokes('SomeCommandClass') * ->withParam('some_param') * ->whoseValueIs('some value'); * ->doesCommand('some_other_command')->whichInvokes('SomeOtherCommandClass') * ; * ?> * @endcode * * The above defines a group with a chain of two commands. The first has a single parameter. The * second has no parameters. */ Config::group('bootstrap'); /** * @page request_config Requests * * This part of the configuration file is used for mapping an inbound request to a * chain of commands. Fortissimo will begin with the first command and process commands * one at a time until the chain has completed (or some error condition has occurred.) * * Requests are "containers" that describe a single process from beginning to end. A request is * a chain of commands. Each command is executed in sequence, with each command having access to * the output of the last command. * * There are a few requests that have special meaning to Fortissimo: * * - default: This is the request that will be executed when no request is explicitly issued. Think * of it as Fortissimo's equivalent to request a base URL. 'default' is equivalent to 'index.html'
* Example: */ // Config::includePath('path/to/include/for/autoloading'); /** * A request maps an incoming request to a series of commands. */ // Create a new request. Config::request('foo')->usesGroup('MyGroup')->doesCommand('bar')->whichInvokes('MyBar')->withParam('text')->whoseValueIs('This is some text')->doesCommand('baz')->whichInvokes('MyBaz')->withParam('path')->from('get:path'); /** * A group is a grouping of commands that cannot be executed as a request. * * They can be referenced in requests, though. Think of it as a way to create a group * of commands that you can use whenever it is convenient. */ // Greate a group. Config::group('bootstrap')->doesCommand('bar')->whichInvokes('MyBar')->withParam('text')->whoseValueIs('This is some text'); /* * Fortissimo provides a very thin database abstraction layer. * * To use it with MongoDB, simply customize the setup below. To use another * database, implement FortissimoDatasource, and then use the implementing * class in the invoke method here. * * You can use as many datasources as you want. Just give each one a different * name. */ // Create a new datasource which connects to a MongoDB server. Config::datasource('db')->whichInvokes('FortissimoMongoDatasource')->withParam('server')->whoseValueIs('mongodb://localhost:27017</param>')->withParam('defaultDB')->whoseValueIs('%%PROJECT%%')->withParam('isDefault')->whoseValueIs(TRUE); /** * Fortissimo allows you to specify one or more loggers to which * important data can be written during the processing of a request.