├── skel ├── cache │ └── .htaccess ├── config │ └── .htaccess ├── theme │ └── vanilla │ │ └── example.twig ├── _htaccess └── index.php ├── doc ├── Commands.mdown ├── Fortissimo-UML-state.gif ├── TODO.txt ├── cli.php ├── Overview.txt ├── QUICKSTART.mdown ├── commands.php ├── README.mdown └── doc.php ├── .gitignore ├── test ├── Tests │ └── Fortissimo │ │ ├── Stubs │ │ └── LoaderStub.php │ │ ├── TestRunner.php │ │ ├── FatalErrorLogger.php │ │ ├── Command │ │ ├── ShowPHPInfoTest.php │ │ ├── EchoTextTest.php │ │ ├── AddToContextTest.php │ │ ├── DumpContextTest.php │ │ ├── IncrementTest.php │ │ ├── IntoArrayTest.php │ │ ├── RunRunnerTest.php │ │ ├── EachTest.php │ │ ├── ParseOptionsTest.php │ │ ├── AddINITest.php │ │ ├── UntilTest.php │ │ └── AddPathToContextTest.php │ │ ├── ExternalCacheHeadersTest.php │ │ ├── RequestMapperTest.php │ │ ├── CLIRunnerTest.php │ │ ├── TestCase.php │ │ ├── FortissimoExceptionsTest.php │ │ ├── FortissimoConfigTest.php │ │ ├── FortissimoExecutionContextTest.php │ │ ├── BaseFortissimoCommandTest.php │ │ └── ConfigTest.php └── test.ini ├── composer.json ├── src └── Fortissimo │ ├── ConfigurationException.php │ ├── RequestNotFoundException.php │ ├── Runtime │ ├── Exception.php │ ├── CLIRunner.php │ ├── WebRunner.php │ └── Runner.php │ ├── Exception.php │ ├── Command │ ├── Flow │ │ ├── Iterator.php │ │ ├── FoldRight.php │ │ ├── Forward.php │ │ ├── Until.php │ │ ├── Wrapper.php │ │ ├── Each.php │ │ └── FoldLeft.php │ ├── Theme │ │ ├── TestTheming.php │ │ ├── RenderTheme.php │ │ ├── InitializeTheme.php │ │ └── BaseThemePackage.php │ ├── Util │ │ ├── Increment.php │ │ ├── Head.php │ │ └── ShowPHPInfo.php │ ├── EchoText.php │ ├── Context │ │ ├── AddToContext.php │ │ ├── IntoArray.php │ │ ├── DumpContext.php │ │ ├── AddINI.php │ │ └── AddPathToContext.php │ ├── CLI │ │ ├── ShowHelp.php │ │ ├── RunRunner.php │ │ └── ReadLine.php │ ├── BaseParameter.php │ └── BaseParameterCollection.php │ ├── Explainable.php │ ├── ErrorException.php │ ├── Interrupt.php │ ├── InterruptException.php │ ├── Logger │ ├── SimpleArrayInjectionLogger.php │ ├── SimpleOutputInjectionLogger.php │ ├── OutputInjectionLogger.php │ ├── ArrayInjectionLogger.php │ ├── MongoCappedLogger.php │ ├── Manager.php │ ├── Syslogger.php │ └── Base.php │ ├── Observable.php │ ├── ForwardRequest.php │ ├── Cache │ ├── RequestCache.php │ ├── Base.php │ ├── Memcache.php │ └── Manager.php │ ├── Datasource │ ├── PDO.php │ ├── MongoDB.php │ └── Base.php │ ├── Request.php │ ├── Cacheable.php │ ├── Command.php │ ├── Autoloader.php │ └── RequestMapper.php ├── registry.php ├── Makefile ├── LICENSE.txt ├── TODO.mdown ├── README.mdown └── fort /skel/cache/.htaccess: -------------------------------------------------------------------------------- 1 | Order Allow,Deny -------------------------------------------------------------------------------- /skel/config/.htaccess: -------------------------------------------------------------------------------- 1 | Order Allow,Deny -------------------------------------------------------------------------------- /doc/Commands.mdown: -------------------------------------------------------------------------------- 1 | # How to Write Fortissimo Commands 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Fortissimo.tmproj 2 | test/reports/html/* 3 | composer.lock 4 | vendor/ 5 | -------------------------------------------------------------------------------- /doc/Fortissimo-UML-state.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/Fortissimo/HEAD/doc/Fortissimo-UML-state.gif -------------------------------------------------------------------------------- /test/Tests/Fortissimo/Stubs/LoaderStub.php: -------------------------------------------------------------------------------- 1 | TRUE)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /doc/TODO.txt: -------------------------------------------------------------------------------- 1 | To Do 2 | ===== 3 | 4 | * Complete command caching mechanism 5 | - Issue: What are we going to cache for commands? 6 | * Data source abstraction layer 7 | * Bootstrap interception? 8 | * Error handling for cached requests. 9 | * Should the logger be a Singleton (or Multiton)? 10 | -------------------------------------------------------------------------------- /registry.php: -------------------------------------------------------------------------------- 1 | route('@test'); 14 | -------------------------------------------------------------------------------- /src/Fortissimo/Runtime/Exception.php: -------------------------------------------------------------------------------- 1 | description('Create an iterator.') 10 | ->usesParam('array', 'The array to convert to an iterator.')->whichIsRequired() 11 | ->andReturns('An Iterable.') 12 | ; 13 | } 14 | 15 | public function doCommand() { 16 | $array = $this->param('array'); 17 | return new \ArrayIterator($array); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/Tests/Fortissimo/FatalErrorLogger.php: -------------------------------------------------------------------------------- 1 | params['ignore'])) { 9 | $this->ignore = $this->params['ignore']; 10 | } 11 | } 12 | 13 | public function log($msg, $severity, $details) { 14 | 15 | if (!in_array($severity, $this->ignore)) { 16 | throw new \Exception($msg . ' ' . $details); 17 | } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /skel/theme/vanilla/example.twig: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 |
11 |{{welcome}}
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Fortissimo/Command/Flow/FoldRight.php: -------------------------------------------------------------------------------- 1 | registry(); 13 | $reg->route('test')->does('\Fortissimo\Command\Util\ShowPHPInfo', 'info'); 14 | 15 | $runner = $this->runner($reg); 16 | 17 | ob_flush(); 18 | ob_start(); 19 | $cxt = $runner->run('test'); 20 | $res = ob_get_clean(); 21 | 22 | $this->assertRegExp('/PHP License/', $res); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Tests/Fortissimo/Command/EchoTextTest.php: -------------------------------------------------------------------------------- 1 | registry(__CLASS__); 13 | $reg->route('default')->does('\Fortissimo\Command\EchoText', 'echo')->using('text', 'Echo'); 14 | 15 | $runner = $this->runner($reg); 16 | 17 | ob_start(); 18 | $runner->run('default'); 19 | $c = ob_get_contents(); 20 | ob_end_clean(); 21 | $c = trim($c); 22 | $this->assertEquals('Echo', $c); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Tests/Fortissimo/Command/AddToContextTest.php: -------------------------------------------------------------------------------- 1 | registry('test'); 12 | $reg->route('test') 13 | ->does('\Fortissimo\Command\Context\AddToContext', 'add') 14 | ->using('test1', 'foo') 15 | ->using('test2', 'bar') 16 | ; 17 | 18 | $runner = $this->runner($reg); 19 | 20 | $cxt = $runner->run('test'); 21 | 22 | $this->assertEquals('foo', $cxt->get('test1')); 23 | $this->assertEquals('bar', $cxt->get('test2')); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Fortissimo/ErrorException.php: -------------------------------------------------------------------------------- 1 | 'test.php'); 13 | } 14 | 15 | public function functions() { 16 | return array( 17 | 'link' => array($this, 'doLink'), 18 | ); 19 | } 20 | 21 | /** 22 | * Make a link. 23 | * 24 | * Takes two arguments: 25 | * - url: The URL to link to 26 | * - text: The text of the link. 27 | */ 28 | public function doLink(&$v) { 29 | return '' . $v['text'] . ''; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/Fortissimo/Interrupt.php: -------------------------------------------------------------------------------- 1 | registry('test'); 12 | $reg->route('cache') 13 | ->does('\Fortissimo\Command\HTTP\ExternalCacheHeaders', 'headers') 14 | ->using('ttl', 1234) 15 | ->route('nocache') 16 | ->does('\Fortissimo\Command\HTTP\ExternalCacheHeaders', 'headers') 17 | ->using('no_cache', TRUE) 18 | ; 19 | 20 | $runner = $this->runner($reg); 21 | /* FIXME: Need to work around the unit testing framework here -- header() doesn't work. 22 | $cxt = $runner->run('cache'); 23 | $headers = headers_list(); 24 | 25 | $this->assertGreaterThan(2, count($headers)); 26 | */ 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Fortissimo/Command/Theme/RenderTheme.php: -------------------------------------------------------------------------------- 1 | description('Render the given variables through the given theme.') 19 | ->usesParam('variables', 'The theme variables') 20 | ->whichIsRequired() 21 | ->usesParam('theme', 'The theme target') 22 | ->whichIsRequired() 23 | ->andReturns('A themed string.') 24 | ; 25 | } 26 | 27 | public function doCommand() { 28 | $target = $this->param('theme'); 29 | $variables = $this->param('variables'); 30 | return Theme::render($target, $variables); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /skel/_htaccess: -------------------------------------------------------------------------------- 1 | # Configuration directives for Apache 2. 2 |%s
'; 46 | var_dump($dump); 47 | print '
%s