Exemplo n.º 1
0
 public function testImageImportFromIncoming()
 {
     // create the default storage location first.
     mkdir($this->getStorageDirectory());
     $this->getStorageLocation();
     $incomingPath = $this->getStorageDirectory() . '/incoming';
     mkdir($incomingPath);
     copy(DIR_BASE . '/concrete/themes/elemental/images/background-slider-night-road.png', $incomingPath . '/trees.png');
     $fi = new Importer();
     $fo = $fi->importIncomingFile('trees.png');
     $this->assertInstanceOf('\\Concrete\\Core\\File\\Version', $fo);
     $type = $fo->getTypeObject();
     $this->assertEquals(\Concrete\Core\File\Type\Type::T_IMAGE, $type->getGenericType());
     $this->assertTrue((bool) $fo->hasThumbnail(1));
     $this->assertTrue((bool) $fo->hasThumbnail(2));
     $this->assertFalse((bool) $fo->hasThumbnail(3));
     $cf = Core::make('helper/concrete/file');
     $fh = Core::make('helper/file');
     $this->assertEquals('http://www.dummyco.com/application/files/thumbnails/file_manager_detail' . $cf->prefix($fo->getPrefix(), $fh->replaceExtension($fo->getFilename(), 'jpg'), 2), $fo->getThumbnailURL('file_manager_detail'));
 }
Exemplo n.º 2
0
 /**
  * Imports a file in the default file storage location's incoming directory.
  *
  * @param string $filename
  * @param ConcreteFile|bool $fr
  *
  * @return number Error Code | \Concrete\Core\File\Version
  */
 public function importIncomingFile($filename, $fr = false)
 {
     return parent::importIncomingFile($filename, $fr);
 }