Constructor.
public __construct ( string $environment, boolean $debug ) | ||
$environment | string | The environment |
$debug | boolean | Whether to enable debugging or not |
public function __construct($environment, $debug) { // Two is better than one... //ini_set("date.timezone", "UTC"); date_default_timezone_set('UTC'); parent::__construct($environment, $debug); }
/** * @param \sfApplicationConfiguration $configuration */ public function __construct(\sfApplicationConfiguration $configuration) { $environment = \sfConfig::get('sf_environment'); $debug = in_array($environment, array('dev', 'ontw', 'test')); parent::__construct($environment, $debug); $this->configuration = $configuration; }
public function __construct($environment, $debug) { if (!ini_get('date.timezone') || !date_default_timezone_get()) { $timezone = "Europe/Berlin"; if (is_link('/etc/localtime')) { // Mac OS X (and older Linuxes) // /etc/localtime is a symlink to the // timezone in /usr/share/zoneinfo. $filename = readlink('/etc/localtime'); if (strpos($filename, '/usr/share/zoneinfo/') === 0) { $timezone = substr($filename, 20); } } elseif (file_exists('/etc/timezone')) { // Ubuntu / Debian. $data = file_get_contents('/etc/timezone'); if ($data) { $timezone = $data; } } elseif (file_exists('/etc/sysconfig/clock')) { // RHEL / CentOS $data = parse_ini_file('/etc/sysconfig/clock'); if (!empty($data['ZONE'])) { $timezone = $data['ZONE']; } } $timezone = preg_replace("/[\\n\\r]+/", "", $timezone); date_default_timezone_set($timezone); } parent::__construct($environment, $debug); }
public function __construct($environment, $debug) { parent::__construct($environment, $debug); if (in_array($environment, array('dev', 'test'))) { date_default_timezone_set('Europe/Copenhagen'); } }
public function __construct(array $configuration, array $enabledBundles, $uniqueIdentifier, $cacheDir, $logsDir) { parent::__construct('test' . $uniqueIdentifier, true); $this->configuration = $configuration; $this->enabledBundles = $enabledBundles; $this->cacheDir = $cacheDir; $this->logsDir = $logsDir; }
/** * {@inheritDoc} * * @param string $environment The environment * @param bool $debug Whether to enable debugging or not * * @return AppKernel */ public function __construct($environment, $debug) { $configuredTimeZone = ini_get('date.timezone'); if (empty($configuredTimeZone)) { date_default_timezone_set('UTC'); } parent::__construct($environment, $debug); }
/** * {@inheritdoc} */ public function __construct($environment, $debug, $projectDir = null) { if (null !== $projectDir) { $this->projectDir = $projectDir; $this->rootDir = $projectDir . '/app'; } parent::__construct($environment, $debug); }
public function __construct($environment, $debug) { parent::__construct($environment, $debug); if ($debug) { Debug::enable(); } $this->initPropel(); }
public function __construct($environment, $debug) { parent::__construct($environment, $debug); $this->dumplieKernel = new DumplieKernel(); foreach ($this->registerDumplieExtensions() as $extension) { $this->dumplieKernel->register($extension); } }
public function __construct($testCase, $environment, $debug) { if (!is_dir(__DIR__ . '/' . $testCase)) { throw new \InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase)); } $this->testCase = $testCase; parent::__construct($environment, $debug); }
/** * Create new application * * @param string environment The environment * @param boolean debug Whether to enable debugging or not * @param array config Optional config settings. */ public function __construct($environment = 'prod', $debug = false, $context = null) { $this->context = $context; // @todo FIXME: Only save it the first time. this gets called again via ConfigCache if (null === Runtime::getContext()) { Runtime::setContext($context); } parent::__construct($environment, $debug); }
/** * {@inheritdoc} */ public function __construct($environment, $debug) { if ('Knp\\Bundle\\RadBundle\\HttpKernel\\RadKernel' === get_class($this)) { throw new \RuntimeException("You can not use Knp\\Bundle\\RadBundle\\HttpKernel\\RadKernel as your application kernel.\n" . "Call RadKernel::createAppKernel(\$loader, '{$environment}', {$debug}) to create specific application kernel."); } parent::__construct($environment, $debug); $this->configuration = $this->initConfiguration(); $this->configuration->load(); }
/** * @param string $rootConfig * @param bool $environment * @param $debug */ public function __construct($rootConfig, $environment, $debug) { $fs = new Filesystem(); if (!$fs->isAbsolutePath($rootConfig) && !is_file($rootConfig = __DIR__ . '/' . $rootConfig)) { throw new \InvalidArgumentException(sprintf('The root config "%s" does not exist.', $rootConfig)); } $this->rootConfig = $rootConfig; parent::__construct($environment, $debug); }
public function __construct($environment, $debug) { if (!static::$runned) { $fileSystem = new Symfony\Component\Filesystem\Filesystem(); $fileSystem->remove($this->getCacheDir()); $fileSystem->remove($this->getLogDir()); static::$runned = true; } parent::__construct($environment, $debug); }
public function __construct($env, $debug) { parent::__construct($env, $debug); // this is all to be deprecated (todo drak) $paths = array($this->rootDir . '/../config/config.php', $this->rootDir . '/../config/personal_config.php', $this->rootDir . '/../config/multisites_config.php'); foreach ($paths as $path) { if (is_readable($path)) { include $path; } } }
public function __construct($env, $debug, $configFilename) { parent::__construct($env, $debug); $this->configFilename = $configFilename; $this->cacheDir = $cacheDir = tempnam(sys_get_temp_dir(), 'raven-bundle-test'); unlink($cacheDir); register_shutdown_function(function () use($cacheDir) { $fs = new Filesystem(); $fs->remove($cacheDir); }); }
public function __construct($config, $debug = true) { parent::__construct('test', $debug); if (!(new Filesystem())->isAbsolutePath($config)) { $config = __DIR__ . '/config/' . $config; } if (!file_exists($config)) { throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); } $this->config = $config; }
public function __construct($environment, $debug) { parent::__construct($environment, $debug); $tempDir = __DIR__ . '/../tmp/'; $filesystem = new Filesystem(); $filesystem->remove($tempDir . 'cache'); $filesystem->remove($tempDir . 'logs'); $filesystem->mkdir($tempDir . 'cache'); $filesystem->mkdir($tempDir . 'logs'); $this->tempDir = $tempDir; }
public function __construct($testCase, $rootConfig, $environment, $debug) { if (!is_dir(__DIR__ . '/' . $testCase)) { throw new \InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase)); } $this->testCase = $testCase; if (!file_exists($filename = __DIR__ . '/' . $testCase . '/' . $rootConfig)) { throw new \InvalidArgumentException(sprintf('The root config "%s" does not exist.', $filename)); } $this->rootConfig = $filename; parent::__construct($environment, $debug); }
public function __construct($environment, $config) { parent::__construct($environment, true); $fs = new Filesystem(); if (!$fs->isAbsolutePath($config)) { $config = __DIR__ . '/config/' . $config; } if (!file_exists($config)) { throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); } $this->config = $config; }
public function __construct() { preg_match('/(.*)\\/(.*)\\/app/', __FILE__, $siteDirMatches); $siteDir = $siteDirMatches[2]; $environment = 'prod'; $devConfigPath = $siteDirMatches[1] . '/' . $siteDir . '.yml'; if (is_file($devConfigPath)) { $this->devConfig = $devConfigPath; $environment = 'dev'; } parent::__construct($environment, 'dev' == $environment); }
public function __construct() { $this->tmpDir = sys_get_temp_dir() . '/sf2_' . rand(1, 9999); if (!is_dir($this->tmpDir)) { if (false === @mkdir($this->tmpDir)) { die(sprintf('Unable to create a temporary directory (%s)', $this->tmpDir)); } } elseif (!is_writable($this->tmpDir)) { die(sprintf('Unable to write in a temporary directory (%s)', $this->tmpDir)); } parent::__construct('env', true); }
public function __construct($config) { $this->rootDir = __DIR__ . DIRECTORY_SEPARATOR; parent::__construct('test', true); $fs = new Filesystem(); if (!$fs->isAbsolutePath($config)) { $config = $this->getRootDir() . '/TestBundle/Resources/config/' . $config; } if (!file_exists($config)) { throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); } $this->config = $config; }
public function __construct($config = 'default.yml') { $this->name = 'app' . uniqid(); parent::__construct('test', true); $fs = new Filesystem(); if (!$fs->isAbsolutePath($config)) { $config = __DIR__ . '/config/' . $config; } if (!file_exists($config)) { throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); } $this->config = $config; }
public function __construct($testCase, $rootConfig, $environment, $debug) { if (!is_dir(__DIR__ . '/' . $testCase)) { throw new \InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase)); } $this->testCase = $testCase; $fs = new Filesystem(); if (!$fs->isAbsolutePath($rootConfig) && !file_exists($rootConfig = __DIR__ . '/' . $testCase . '/' . $rootConfig)) { throw new \InvalidArgumentException(sprintf('The root config "%s" does not exist.', $rootConfig)); } $this->rootConfig = $rootConfig; parent::__construct($environment, $debug); }
public function __construct($config, $debug) { parent::__construct('config', $debug); $fs = new Filesystem(); if (!$fs->isAbsolutePath($config)) { $config = __DIR__ . '/config/' . $config . ".yml"; } if (!file_exists($config)) { throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); } $this->config = $config; file_put_contents('/tmp/log.f', $this->getCacheDir() . PHP_EOL, FILE_APPEND); }
public function __construct($config, $testEnv = 'default') { //separate generated container parent::__construct($testEnv . '_' . substr(md5($config), 0, 3), true); $fs = new Filesystem(); if (!$fs->isAbsolutePath($config)) { $config = __DIR__ . '/config/' . $config; } if (!file_exists($config)) { throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); } $this->config = $config; $this->testEnv = $testEnv; }
/** * Register commonly needed bundle sets and then * after initializing the parent kernel, let the * concrete kernel configure itself using the abstracvt * configure() command. */ public function __construct($env, $debug) { $this->registerBundleSet('default', array('Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle', 'Symfony\\Bundle\\SecurityBundle\\SecurityBundle', 'Symfony\\Bundle\\TwigBundle\\TwigBundle', 'Symfony\\Bundle\\MonologBundle\\MonologBundle')); $this->registerBundleSet('phpcr_odm', array('Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle', 'Doctrine\\Bundle\\PHPCRBundle\\DoctrinePHPCRBundle')); $this->registerBundleSet('doctrine_orm', array('Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle')); $baseSonataBundles = array('Sonata\\BlockBundle\\SonataBlockBundle', 'Sonata\\CoreBundle\\SonataCoreBundle', 'Sonata\\AdminBundle\\SonataAdminBundle', 'Knp\\Bundle\\MenuBundle\\KnpMenuBundle', 'FOS\\JsRoutingBundle\\FOSJsRoutingBundle'); if (class_exists('Sonata\\jQueryBundle\\SonatajQueryBundle')) { $baseSonataBundles[] = 'Sonata\\jQueryBundle\\SonatajQueryBundle'; } $this->registerBundleSet('sonata_admin_orm', array_merge(array('Sonata\\DoctrineORMAdminBundle\\SonataDoctrineORMAdminBundle'), $baseSonataBundles)); $this->registerBundleSet('sonata_admin_phpcr', array_merge(array('Sonata\\DoctrinePHPCRAdminBundle\\SonataDoctrinePHPCRAdminBundle', 'Symfony\\Cmf\\Bundle\\TreeBrowserBundle\\CmfTreeBrowserBundle'), $baseSonataBundles)); parent::__construct($env, $debug); $this->configure(); }
public function __construct() { $env = Kwf_Config::getValue('symfony.environment'); if (in_array($env, array('test', 'dev'))) { $environment = $env; $debug = true; //Debug::enable(); } else { $environment = 'prod'; $debug = false; } parent::__construct($environment, $debug); AnnotationRegistry::registerLoader(array('Kwf_Loader', 'loadClass')); }
public function __construct() { $this->rootDir = sys_get_temp_dir() . '/sf2_' . rand(1, 9999); if (!is_dir($this->rootDir)) { if (false === @mkdir($this->rootDir)) { exit(sprintf('Unable to create a temporary directory (%s)', $this->rootDir)); } } elseif (!is_writable($this->rootDir)) { exit(sprintf('Unable to write in a temporary directory (%s)', $this->rootDir)); } parent::__construct('env', true); $loader = new UniversalClassLoader(); $loader->registerNamespaces(array('TestBundle' => __DIR__ . '/Fixtures/', 'TestApplication' => __DIR__ . '/Fixtures/')); $loader->register(); }