/** * Get thumbnail */ public function testGetTumbnail() { $this->_setConf('logo', array('mimetype' => 'image/jpg', 'quality' => 25)); $proxy = new Replica_ImageProxy_FromFile('/some/file'); $proxy->setMimeType('image/jpg'); $proxy->setQuality(25); $cache = $this->getMock('Replica_Macro_CacheManager', array('get'), array('/save/dir')); $cache->expects($this->once())->method('get')->with('logo', $proxy)->will($this->returnValue($path = 'path/to/thumbnail')); Replica::setCacheManager($cache); $expected = sprintf('<img src="/upload/%s" alt="" />', $path); $this->assertEquals($expected, thumbnail('logo', new Replica_ImageProxy_FromFile('/some/file'))); }
/** * Initialize * * @see sfPluginConfiguration */ public function initialize() { $dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . ltrim(sfConfig::get('app_thumbnail_dir'), '\\/'); Replica::setCacheManager(new Replica_Macro_CacheManager($dir)); }
/** * TearDown */ public function tearDown() { sfConfig::clear(); Replica::removeAll(); Replica::setCacheManager(null); }