/**
  * 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);
 }
示例#2
0
 /**
  * Test that the stapler class can build a single instance of
  * Codesleeve\Stapler\Config\NativeConfig.
  *
  * @test
  */
 public function it_should_be_able_to_create_a_singleton_native_config_instance()
 {
     $config1 = Stapler::getConfigInstance();
     $config2 = Stapler::getConfigInstance();
     $this->assertInstanceOf('Codesleeve\\Stapler\\Config\\NativeConfig', $config1);
     $this->assertInstanceOf('Codesleeve\\Stapler\\Interfaces\\Config', $config1);
     $this->assertSame($config1, $config2);
 }
示例#3
-1
 /**
  * Merge configuration options.
  * Here we'll merge user defined options with the stapler defaults in a cascading manner.
  * We start with overall stapler options.  Next we merge in storage driver specific options.
  * Finally we'll merge in attachment specific options on top of that.
  *
  * @param array $options
  *
  * @return array
  */
 protected static function mergeOptions(array $options)
 {
     $config = Stapler::getConfigInstance();
     $defaultOptions = $config->get('stapler');
     $options = array_merge($defaultOptions, (array) $options);
     $storage = $options['storage'];
     $options = array_replace_recursive($config->get($storage), $options);
     $options['styles'] = array_merge((array) $options['styles'], ['original' => '']);
     return $options;
 }