public function testGetImageNotFromCacheAsObject() { $lifetime = 12; $checksum = '2fff960136929390427f9409eac34c42'; $imagedata = 'mocked image data'; $image = Mockery::mock('\Intervention\Image\Image'); $image->shouldReceive('resize')->with(100, 150)->once()->andReturn($image); $image->shouldReceive('encode')->with()->once()->andReturn($imagedata); $manager = Mockery::mock('\Intervention\Image\ImageManager'); $manager->shouldReceive('make')->with('foo/bar.jpg')->once()->andReturn($image); $cache = Mockery::mock('\Illuminate\Cache\Repository'); $cache->shouldReceive('get')->with($checksum)->once()->andReturn(false); $cache->shouldReceive('put')->with($checksum, $imagedata, $lifetime)->once()->andReturn(false); $img = new ImageCache($manager, $cache); $img->make('foo/bar.jpg'); $img->resize(100, 150); $result = $img->get($lifetime, true); $this->assertEquals($imagedata, $result); }