public function setUp()
 {
     Config::initialize();
     Config::request('foo')->doesCommand('test')->whichInvokes('ExceptionThrowingCommand');
     Config::request('div')->doesCommand('test')->whichInvokes('ErrorThrowingCommand');
     Config::logger('fail')->whichInvokes('FortissimoArrayInjectionLogger');
 }
Example #2
0
 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);
     }
 }
 *       ->whoseValueIs(FALSE)
 *     // ->withParam('debug')->whoseValueIs(FALSE)
 *     // ->withParam('trimBlocks')->whoseValueIs(TRUE)
 *     // ->withParam('auto_reload')->whoseValueIs(FALSE)
 *
 *   // Send the rendered welcome page to the browser.
 *   ->doesCommand('echo')
 *     ->whichInvokes('FortissimoEcho')
 *     ->from('context:tpl')
 * ;
 * ?>
 * @endcode
 *
 * A request can have two things in its chain: commands and groups.
 */
Config::request('default')->usesGroup('bootstrap')->doesCommand('initContext')->whichInvokes('FortissimoAddToContext')->withParam('title')->whoseValueIs('%%PROJECT%%')->withParam('welcome')->whoseValueIs('Fortissimo has been successfully installed.')->doesCommand('tpl')->whichInvokes('FortissimoTemplate')->withParam('template')->whoseValueIs('example.twig')->withParam('templateDir')->whoseValueIs('theme/vanilla')->withParam('templateCache')->whoseValueIs('./cache')->withParam('disableCache')->whoseValueIs(TRUE)->doesCommand('echo')->whichInvokes('FortissimoEcho')->withParam('text')->from('context:tpl');
/**
 * @page logger_config Loggers
 *
 * You can configure Fortissimo to log to one or more logging backends.
 *
 * @code
 * Config::logger('foil')
 *  ->whichInvokes('FortissimoOutputInjectionLogger')
 * ;
 * @endcode
 *
 * The code above configures Fortissimo's FOIL logger, which simply logs all errors into Standard
 * Output. Another built-in logger is FortissimoArrayInjectionLogger (FAIL), which logs messages
 * into an array for later retrieval.
 *
Example #4
0
/**
 * Fortissimo users the SPL autoloader to load classes, where the 
 * assumption is that ClassName is stored in ClassName.php, ClassName.cmd.php,
 * or ClassName.inc.
 *
 * To add additional directories to the class loader, specify them here.
 *
 * 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.
 *