Author: XE Developers (developers@xpressengine.com)
 public function testGenerate()
 {
     list($manager) = $this->getMocks();
     Thumbnailer::setManager($manager);
     $instance = new Thumbnailer();
     $imageContent = file_get_contents(__DIR__ . '/sample.png');
     $mockCommand = m::mock('Xpressengine\\Media\\Commands\\CommandInterface');
     $mockCommand->shouldReceive('getName')->andReturn('letter');
     $mockCommand->shouldReceive('setOriginDimension')->once()->with(m::on(function ($object) {
         return $object instanceof Dimension;
     }));
     $mockCommand->shouldReceive('getMethod')->andReturn('resize');
     $mockCommand->shouldReceive('getExecArgs')->andReturn([100, 100]);
     $mockItvImage = m::mock('Intervention\\Image\\Image');
     $mockItvImage->shouldReceive('resize')->once()->with(100, 100)->andReturnSelf();
     $mockItvImage->shouldReceive('encode')->once()->andReturnSelf();
     $mockItvImage->shouldReceive('getEncoded')->once();
     $manager->shouldReceive('make')->once()->with($imageContent)->andReturn($mockItvImage);
     $instance->setOrigin($imageContent)->addCommand($mockCommand)->generate();
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     Thumbnailer::setManager(new ImageManager());
 }
 private function registerImageHandler()
 {
     $this->app->singleton('xe.user.image', function ($app) {
         $profileImgConfig = config('xe.user.profileImage');
         return new UserImageHandler($app['xe.storage'], $app['xe.media'], function () {
             return Thumbnailer::getManager();
         }, $profileImgConfig);
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     Media::setUrlMaker($this->app['xe.storage.url']);
     Thumbnailer::setManager(new ImageManager());
 }