/** * Bootstrap up the stapler package: * - Boot stapler. * - Set the config driver. * - Set public_path config using laravel's public_path() method (if necessary). * - Set base_path config using laravel's base_path() method (if necessary). * * @return void */ protected function bootstrapStapler() { Stapler::boot(); $config = new IlluminateConfig(Config::getFacadeRoot(), 'laravel-stapler'); Stapler::setConfigInstance($config); if (!$config->get('stapler.public_path')) { $config->set('stapler.public_path', realpath(public_path())); } if (!$config->get('stapler.base_path')) { $config->set('stapler.base_path', realpath(base_path())); } }
/** * Bootstrap up the stapler package: * - Boot stapler. * - Set the config driver. * - Set public_path config using laravel's public_path() method (if necessary). * - Set base_path config using laravel's base_path() method (if necessary). * * @return void */ protected function bootstrapStapler() { Stapler::boot(); $config = new NativeConfig($this->app['config']->get('stapler')); Stapler::setConfigInstance($config); if (!$config->get('stapler.public_path')) { $config->set('stapler.public_path', realpath(public_path())); } if (!$config->get('stapler.base_path')) { $config->set('stapler.base_path', realpath(base_path())); } }
/** * Test that the stapler class can build a single instance of * Codesleeve\Stapler\Config\IlluminateConfig. * * @test * @return void */ public function it_should_be_able_to_create_set_singleton_config_instance() { $loaderInterface = m::mock('Illuminate\\Config\\loaderInterface'); $illuminateConfig = new \Illuminate\Config\Repository($loaderInterface, 'testing'); $config1 = new Config\IlluminateConfig($illuminateConfig, 'test'); Stapler::setConfigInstance($config1); $config2 = Stapler::getConfigInstance(); $this->assertInstanceOf('Codesleeve\\Stapler\\Config\\IlluminateConfig', $config1); $this->assertInstanceOf('Codesleeve\\Stapler\\Config\\ConfigurableInterface', $config1); $this->assertSame($config1, $config2); }