private function createApp() { $app = new App(); $app->getKernel()->addProvider(ErrorHandlerProvider::class); $app->run(); return $app; }
private function createApp() { $app = new App(); $app->getKernel()->addProviders([ErrorHandlerProvider::class, BugsnagErrorHandlerProvider::class]); $config = new Config([BugsnagErrorHandlerConfig::CLIENT_ID => 'client_id', BugsnagErrorHandlerConfig::PROJECT_ROOT => __DIR__, BugsnagErrorHandlerConfig::HOSTNAME => 'hostname']); $app->getConfigLoader()->addConfig($config); $app->start(); return $app; }
private function createApp() { $app = new App(); $config = new Config(); $config->set(MonologConfig::DEFAULT_CHANNEL_NAME, 'error'); $config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('error'), path(__DIR__, 'error.txt')); $config->set(MonologConfig::LOG_CHANNEL_LOG_LEVEL('error'), 'debug'); $config->set(MonologErrorHandlerConfig::ERROR_CHANNEL_NAME, 'error'); $app->getConfigLoader()->addConfig($config); return $app; }
/** * ConsoleApp constructor. * * @param string $environment * @param bool $debug */ public function __construct($environment = null, $debug = null) { parent::__construct($environment, $debug); $this->console = $this->createConsole(); $this->container->set([ConsoleApp::class, IConsoleApp::class], $this); $this->container->set([Console::class, IConsole::class], $this->console); $this->addDefaultCommands(); }
/** * @param string $metadataFormat * @param bool $debug * * @return App */ public function createApp($metadataFormat = 'yaml', $debug = true) { $app = new App(); $config = new Config(); $config->set(DoctrineConfig::DEBUG, $debug); $config->set(DoctrineConfig::CONFIG, ['driver' => 'pdo_sqlite', 'memory' => true]); $config->set(DoctrineConfig::ENTITIES_MAPPINGS, []); $config->set(DoctrineConfig::ENTITIES_PATHS, []); $config->set(DoctrineConfig::METADATA_FORMAT, $metadataFormat); $config->set(DoctrineConfig::CACHE_PATH, '/tmp'); $config->set(DoctrineConfig::MIGRATIONS_PATH, '/tmp'); $config->set(DoctrineConfig::MIGRATIONS_NAMESPACE, 'migrations'); $config->set(DoctrineConfig::MIGRATIONS_TABLE, 'migrations'); $app->getConfigLoader()->addConfig($config); $app->getKernel()->addProvider(DoctrineProvider::class); return $app; }
/** * HttpApp constructor. * * @param string $environment * @param bool $debug */ public function __construct($environment = null, $debug = null) { parent::__construct($environment, $debug); $this->container->set([HttpApp::class, IHttpApp::class], $this); }
public function test_debug_is_propagated_to_config() { $app = new App(null, true); $app->start(); $this->assertEquals(true, $app->getConfig()->get('debug')); }
<?php use Weew\App\App; use Weew\App\Doctrine\DoctrineConfig; use Weew\App\Doctrine\DoctrineProvider; require __DIR__ . '/../../../../vendor/autoload.php'; $app = new App(); $config = $app->getConfig(); $config->set(DoctrineConfig::DEBUG, true); $config->set(DoctrineConfig::CONFIG, ['driver' => 'pdo_sqlite', 'memory' => true]); $config->set(DoctrineConfig::ENTITIES_PATHS, ''); $config->set(DoctrineConfig::METADATA_FORMAT, 'yaml'); $config->set(DoctrineConfig::CACHE_PATH, '/tmp'); $config->set(DoctrineConfig::MIGRATIONS_PATH, '/tmp'); $config->set(DoctrineConfig::MIGRATIONS_NAMESPACE, 'migrations'); $config->set(DoctrineConfig::MIGRATIONS_TABLE, 'migrations'); $app->getKernel()->addProvider(DoctrineProvider::class); $app->start(); /** @var DoctrineProvider $doctrineProvider */ $doctrineProvider = $app->getContainer()->get(DoctrineProvider::class); $doctrineProvider->runConsoleRunner();