public function test_get_error_channel_name()
 {
     $config = new Config();
     $config->set(MonologErrorHandlerConfig::ERROR_CHANNEL_NAME, 'error_channel');
     $monologConfig = new MonologErrorHandlerConfig($config);
     $this->assertEquals('error_channel', $monologConfig->getErrorChannelName());
 }
 function let()
 {
     $config = new Config();
     $config->set(SwiftMailerConfig::TRANSPORTS, ['default' => ['type' => 'null'], 'sendmail' => ['type' => 'sendmail', 'command' => 'command'], 'smtp' => ['type' => 'smtp', 'host' => 'localhost', 'port' => 25, 'username' => 'username', 'password' => 'password'], 'not_supported' => ['type' => 'not_supported']]);
     $swiftMailerConfig = new SwiftMailerConfig($config);
     $this->beConstructedWith($swiftMailerConfig);
 }
 function it_is_enabled_if_disabled_is_set_to_false()
 {
     $config = new Config();
     $config->set(BlackHoleErrorHandlerConfig::DISABLED, false);
     $this->beConstructedWith($config);
     $this->getEnabled()->shouldBe(true);
 }
Ejemplo n.º 4
0
 function it_throws_an_error_if_a_logging_channel_config_has_no_log_level()
 {
     $config = new Config();
     $config->set(MonologConfig::DEFAULT_CHANNEL_NAME, 'channel_name');
     $config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('channel_name'), 'log_path');
     $this->beConstructedWith($config);
     $this->shouldThrow(MissingConfigException::class)->duringInstantiation();
 }
Ejemplo n.º 5
0
 /**
  * @return MonologChannelManager
  */
 private function createChannelManager()
 {
     $config = new Config();
     $config->set(MonologConfig::DEFAULT_CHANNEL_NAME, 'channel');
     $config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('channel'), '/tmp');
     $config->set(MonologConfig::LOG_CHANNEL_LOG_LEVEL('channel'), 'debug');
     $monologConfig = new MonologConfig($config);
     return new MonologChannelManager($monologConfig);
 }
 function it_searches(Input $input)
 {
     $input->getOption('--flat')->willReturn(true);
     $input->getArgument('search')->willReturn('some.nested');
     $output = new Output();
     $output->setEnableBuffering(true);
     $config = new Config();
     $config->set('some', ['nested' => 'value']);
     $this->run($input, $output, $config);
 }
Ejemplo n.º 7
0
 public function test_parse_blocks()
 {
     $parser = new ConfigParser();
     $config = new Config();
     $config->set('foo', '{bar}');
     $config->set('bar', ['yolo' => 'swag']);
     $this->assertEquals(['baz' => ['yolo' => 'swag']], $parser->parse($config, ['baz' => '{foo}']));
     $this->assertEquals(['baz.swag' => ['yolo' => 'swag']], $parser->parse($config, ['baz.{foo.yolo}' => '{foo}']));
     $this->assertEquals(['baz.{foo}' => ['yolo' => 'swag']], $parser->parse($config, ['baz.{foo}' => '{foo}']));
 }
 public function test_create()
 {
     $app = new HttpApp();
     $config = new Config();
     $config->set('routing', ['routes' => [['method' => 'GET', 'path' => '/foo', 'action' => 'foo']]]);
     $app->getConfigLoader()->addConfig($config);
     $app->getKernel()->addProvider(RequestHandlerProvider::class);
     $app->handleRequest(new HttpRequest());
     /** @var IRouter $router */
     $router = $app->getContainer()->get(IRouter::class);
     $handler = $app->getContainer()->get(IRequestHandler::class);
     $routes = $router->getRoutes();
     $this->assertEquals(1, count($routes));
     $route = $routes[0];
     $this->assertEquals(['GET'], $route->getMethods());
     $this->assertEquals('/foo', $route->getPath());
     $this->assertEquals('foo', $route->getAction());
 }
 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;
 }
Ejemplo n.º 10
0
 function let()
 {
     $config = new Config();
     $config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('channel1'), path('/tmp', uuid(), 'channel1.log'));
     $config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('channel2'), path('/tmp', uuid(), 'channel2.log'));
     $config->set(MonologConfig::LOG_CHANNEL_LOG_LEVEL('channel1'), 'debug');
     $config->set(MonologConfig::LOG_CHANNEL_LOG_LEVEL('channel2'), 'debug');
     $config->set(MonologConfig::DEFAULT_CHANNEL_NAME, 'channel1');
     $monologConfig = new MonologConfig($config);
     $this->beConstructedWith($monologConfig);
 }
Ejemplo n.º 11
0
 public function test_is_chainable_trough_extend()
 {
     $config = new Config();
     $this->assertTrue($config->extend(new Config()) === $config);
 }
Ejemplo n.º 12
0
 private function createConfig()
 {
     $config = new Config();
     $config->set(SwiftMailerConfig::TRANSPORTS, ['default' => ['type' => 'null'], 'null' => ['type' => 'null'], 'sendmail' => ['type' => 'sendmail', 'command' => 'command'], 'smtp' => ['type' => 'smtp', 'host' => 'host', 'port' => 'port', 'username' => 'username', 'password' => 'password']]);
     return $config;
 }
Ejemplo n.º 13
0
 private function createConfig()
 {
     $config = new Config();
     $config->set(DoctrineConfig::DEBUG, true);
     $config->set(DoctrineConfig::METADATA_FORMAT, 'yaml');
     $config->set(DoctrineConfig::ENTITIES_PATHS, ['entities_path']);
     $config->set(DoctrineConfig::ENTITIES_MAPPINGS, ['/path' => 'some\\namespace']);
     $config->set(DoctrineConfig::CACHE_PATH, 'cache_path');
     $config->set(DoctrineConfig::PROXY_CLASSES_PATH, 'proxy_path');
     $config->set(DoctrineConfig::CONFIG, []);
     $config->set(DoctrineConfig::MIGRATIONS_NAMESPACE, 'migrations_namespace');
     $config->set(DoctrineConfig::MIGRATIONS_PATH, 'migrations_path');
     $config->set(DoctrineConfig::MIGRATIONS_TABLE, 'migrations_table');
     return $config;
 }
 public function test_getters()
 {
     $config = new Config();
     $config->set(BugsnagErrorHandlerConfig::CLIENT_ID, 'client_id');
     $config->set(BugsnagErrorHandlerConfig::ENVIRONMENT, 'environment');
     $config->set(BugsnagErrorHandlerConfig::FILTERS, ['filters']);
     $config->set(BugsnagErrorHandlerConfig::METADATA, ['metadata']);
     $config->set(BugsnagErrorHandlerConfig::ENABLED_ENVIRONMENTS, ['notify_in']);
     $config->set(BugsnagErrorHandlerConfig::SEND_CODE, 'send_code');
     $config->set(BugsnagErrorHandlerConfig::TYPE, 'type');
     $config->set(BugsnagErrorHandlerConfig::AUTO_NOTIFY, 'auto_notify');
     $config->set(BugsnagErrorHandlerConfig::PROJECT_ROOT, 'project_root');
     $config->set(BugsnagErrorHandlerConfig::HOSTNAME, 'hostname');
     $config->set(BugsnagErrorHandlerConfig::NUMBER_OF_SKIPPED_STACK_TRACE_LINES, 10);
     $settings = new BugsnagErrorHandlerConfig($config);
     $this->assertEquals('client_id', $settings->getClientId());
     $this->assertEquals('environment', $settings->getEnvironment());
     $this->assertEquals(['filters'], $settings->getFilters());
     $this->assertEquals(['metadata'], $settings->getMetadata());
     $this->assertEquals(['notify_in'], $settings->getEnabledEnvironments());
     $this->assertEquals('send_code', $settings->getSendCode());
     $this->assertEquals('type', $settings->getType());
     $this->assertEquals('auto_notify', $settings->getAutoNotify());
     $this->assertEquals('project_root', $settings->getProjectRoot());
     $this->assertEquals('hostname', $settings->getHostname());
     $this->assertEquals(10, $settings->getNumberOfSkippedStackTraceLines());
     $config->remove(BugsnagErrorHandlerConfig::NUMBER_OF_SKIPPED_STACK_TRACE_LINES);
     $this->assertEquals(0, $settings->getNumberOfSkippedStackTraceLines());
 }
Ejemplo n.º 15
0
 private function createConfig()
 {
     $config = new Config();
     $config->set(TwigConfig::DEBUG, true);
     return $config;
 }
Ejemplo n.º 16
0
 /**
  * @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;
 }