示例#1
0
 /**
  * Create a new attachment object.
  *
  * @param string $name
  * @param array $options
  * @return \Codesleeve\Stapler\Attachment
  */
 public static function create($name, array $options)
 {
     $options = static::mergeOptions($options);
     Stapler::getValidatorInstance()->validateOptions($options);
     list($config, $interpolator, $resizer) = static::buildDependencies($name, $options);
     $attachment = new AttachmentObject($config, $interpolator, $resizer);
     $storageDriver = StorageFactory::create($attachment);
     $attachment->setStorageDriver($storageDriver);
     return $attachment;
 }
示例#2
0
 /**
  * Test that the Storage factory should create an instance of the filesystem
  * storage driver by default.
  *
  * @test
  */
 public function it_should_be_able_to_create_a_filesystem_storeage_instance_by_default()
 {
     $attachment = $this->buildMockAttachment();
     $storage = Storage::create($attachment);
     $this->assertInstanceOf('Codesleeve\\Stapler\\Storage\\Filesystem', $storage);
 }