/** * @return Build\Application */ function getApplication() { static $application; if (!$application) { $factory = \Cti\Core\Application\Factory::create(__DIR__ . '/tests/'); $application = $factory->getApplication(); } return $application; }
function testView() { $factory = Application\Factory::create(__DIR__); $application = $factory->getApplication(); $project = $application->getProject(); $view = new View($project); ob_start(); $view->show('test'); $this->assertSame($view->render('test'), ob_get_clean()); $this->assertSame('exception', $view->render('exception', array('test' => true))); }
/** * process deploy * @param InputInterface $input * @param OutputInterface $output * @return null * @throws \Cti\Di\Exception */ protected function execute(InputInterface $input, OutputInterface $output) { // clean up $filesystem = new Filesystem(); $filesystem->remove($this->getApplication()->getProject()->getPath('build cache')); $filesystem->remove($this->getApplication()->getProject()->getPath('build php')); // check cache module configuration $configuration = $this->getApplication()->getManager()->getConfiguration(); $enabled = $configuration->get('Cti\\Core\\Module\\Cache', 'enabled', true); if (!$enabled) { throw new Exception("Module\\Cache should be enabled"); } // create and warm application $root = $this->getApplication()->getProject()->getPath(); Factory::create($root)->getApplication()->warm(); }
<?php use Cti\Core\Application\Factory; $root = dirname(dirname(__DIR__)); include $root . '/vendor/autoload.php'; include $root . '/../sencha/vendor/autoload.php'; include $root . '/../storage/vendor/autoload.php'; include $root . '/../core/vendor/autoload.php'; include $root . '/../direct/vendor/autoload.php'; chdir($root); Factory::create($root)->getApplication()->getConsole()->run();
function testForceGenerate() { $config = array('Cti\\Core\\Module\\Project' => array('path' => __DIR__), 'Cti\\Core\\Application\\Factory' => array('generate' => true)); Factory::create($config); }
/** * @return Coffee */ protected function getCoffee() { $config = array('Cti\\Core\\Module\\Project' => array('path' => __DIR__)); return Application\Factory::create($config)->getApplication()->getCoffee(); }
<?php if (strpos($_SERVER['REQUEST_URI'], '/public') === 0) { return false; } if (strpos($_SERVER['REQUEST_URI'], '/favicon.ico') === 0) { return false; } use Cti\Core\Application\Factory; $root = dirname(dirname(__DIR__)); include $root . '/vendor/autoload.php'; chdir($root); Factory::create($root)->getApplication()->getWeb()->run();
function testNotFoundException() { $this->setExpectedException('Exception'); Factory::create(__DIR__)->getApplication()->getFenom()->display('fail'); }