Example #1
0
 public function testClear()
 {
     $this->image->setLocal($this->file);
     $this->image->setRemote('http://example.com/foo');
     $this->image->clear();
     $this->assertEmpty($this->image->getLocal());
     $this->assertEmpty($this->image->getRemote());
 }
Example #2
0
 /**
  * @param Image $entity
  * @param bool $override
  *
  * @return string
  */
 protected function getTargetDirForImageField(Image $entity, $override = false)
 {
     $target = $this->root . $entity->getDownloadPath() . '/' . $entity->getFilename();
     if (!$override) {
         $target = $this->getUniqueFilename($target);
         $entity->setFilename(pathinfo($target, PATHINFO_BASENAME));
         // update filename
     }
     return $target;
 }