Example #1
0
 public function testDatasources()
 {
     // Define one.
     $cfg = Config::datasource('foo')->whichInvokes('bar');
     // Define a second one.
     $cfg = Config::datasource('db')->whichInvokes('FortissimoMongoDatasource')->withParam('server')->whoseValueIs('mongodb://localhost:27017</param>')->withParam('defaultDB')->whoseValueIs('BONGO')->withParam('isDefault')->whoseValueIs(TRUE)->getConfiguration();
     $this->assertEquals(2, count($cfg[Config::DATASOURCES]));
     $entry = $cfg[Config::DATASOURCES]['db'];
     $this->assertEquals('BONGO', $entry['params']['defaultDB']['value']);
     $this->assertEquals('FortissimoMongoDatasource', $entry['class']);
     $this->assertEquals('bar', $cfg[Config::DATASOURCES]['foo']['class']);
 }
 * class in the invoke method here.
 *
 * @code
 * Config::datasource('db') // Name of datasource
 *   ->whichInvokes('FortissimoMongoDatasource') // The class it uses
 *   // Parameters for the FortissimoMongoDatasource:
 *   ->withParam('server')->whoseValueIs('mongodb://localhost:27017')
 *   ->withParam('defaultDB')->whoseValueIs('my_db_name')
 *   ->withParam('isDefault')->whoseValueIs(TRUE) // Only datasource one can be default.
 * ;
 * @endcode
 *
 * You can use as many datasources as you want. Just give each one a different
 * name.
 */
Config::datasource('db')->whichInvokes('FortissimoMongoDatasource')->withParam('server')->whoseValueIs('mongodb://localhost:27017')->withParam('defaultDB')->whoseValueIs('my_db_name')->withParam('isDefault')->whoseValueIs(TRUE);
/**
 * @page group_config Groups
 * A group is a grouping of commands that cannot be executed as a request.
 *
 * While they are not directly executed (ever), they can be included into a request. See the 
 * example in the section on requests.
 *
 * Example:
 *
 * @code
 * <?php
 * Config::group('bootstrap')
 *   ->doesCommand('some_command')
 *     ->whichInvokes('SomeCommandClass')
 *     ->withParam('some_param')