/** * 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())); } }
/** * 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())); } }
/** * Setup method. */ public function setUp() { parent::setUp(); Stapler::boot(); }
/** * Test that the Stapler class can define an value for the STAPLER_NULL * constant. * * @test * @return void */ public function it_should_be_able_to_define_a_stapler_null_constant() { Stapler::boot(); $this->assertTrue(defined('STAPLER_NULL')); }
/** * Build an attachment object. * * @param \Codesleeve\Stapler\Interpolator * @return \Codesleeve\Stapler\Attachment */ protected function build_attachment() { Stapler::boot(); $instance = $this->build_mock_instance(); $interpolator = new Interpolator(); $attachmentConfig = new \Codesleeve\Stapler\AttachmentConfig('photo', ['styles' => [], 'placeholder_style' => 'original', 'url' => '/system/:attachment/:id_partition/:style/:filename', 'path' => ':app_root/public:url']); $imagine = m::mock('Imagine\\Image\\ImagineInterface'); $resizer = new \Codesleeve\Stapler\File\Image\Resizer($imagine); $attachment = new \Codesleeve\Stapler\Attachment($attachmentConfig, $interpolator, $resizer); $attachment->setInstance($instance); $storageDriver = new \Codesleeve\Stapler\Storage\Filesystem($attachment); $attachment->setStorageDriver($storageDriver); return $attachment; }