$app = new Application(); $app->setBasePath('folder'); expect($app->basePath())->toBe('folder'); expect($app->basePath('file.php'))->toBe('folder/file.php'); }); }); describe("->configPath()", function () { it("returns the applications config path, defaulted to the config directory", function () { $app = new Application(); expect($app->configPath())->toBe(getcwd() . '/config'); expect($app->configPath('foo.php'))->toBe(getcwd() . '/config/foo.php'); }); it("sets the application config path", function () { $app = new Application(); $app->setConfigPath('folder'); expect($app->configPath())->toBe(getcwd() . '/folder'); expect($app->configPath('file.php'))->toBe(getcwd() . '/folder/file.php'); }); }); describe("->environment()", function () { it("returns the current application environment", function () { $app = new Application(); expect($app->environment())->toBe('development'); }); it("returns the environment from the app config file", function () { mkdir('/tmp/config'); file_put_contents('/tmp/config/app.php', "<?php return ['environment' => 'testing'];"); $app = new Application(); $app->setBasePath('/tmp'); $app->setConfigPath('config'); $app->boot();
/** * Load the application configuration files * * @param \Siphon\Application $app */ protected function loadAppConfig($app) { if (is_dir($app->configPath())) { $app['config.loader']->load($app->configPath()); } }