Esempio n. 1
0
    public function testProcess()
    {
        $image = Mockery::mock('\Intervention\Image\Image');
        $image->shouldReceive('resize')->with(300, 200)->once()->andReturn($image);
        $image->shouldReceive('blur')->with(2)->once()->andReturn($image);
        $manager = Mockery::mock('\Intervention\Image\ImageManager');
        $manager->shouldReceive('make')->with('foo/bar.jpg')->once()->andReturn($image);
        $cache = Mockery::mock('\Illuminate\Cache\Repository');

        $img = new ImageCache($manager, $cache);
        $img->make('foo/bar.jpg');
        $img->resize(300, 200);
        $img->blur(2);
        $result = $img->process();

        $this->assertEquals(count($img->calls), 0);
        $this->assertInstanceOf('Intervention\Image\Image', $result);        
        $this->assertEquals('e795d413cf6598f49a8e773ce2e07589', $result->cachekey);
    }
Esempio n. 2
0
 public function testProcess()
 {
     $image = Mockery::mock('\\Intervention\\Image\\Image');
     $image->shouldReceive('resize')->with(300, 200)->once()->andReturn($image);
     $image->shouldReceive('blur')->with(2)->once()->andReturn($image);
     $manager = Mockery::mock('\\Intervention\\Image\\ImageManager');
     $manager->shouldReceive('make')->with('foo/bar.jpg')->once()->andReturn($image);
     $cache = Mockery::mock('\\Illuminate\\Cache\\Repository');
     $img = new ImageCache($manager, $cache);
     $img->make('foo/bar.jpg');
     $img->resize(300, 200);
     $img->blur(2);
     $result = $img->process();
     $this->assertEquals(count($img->calls), 0);
     $this->assertInstanceOf('Intervention\\Image\\Image', $result);
     $this->assertEquals('9538f2e38b3f6878936bfea3b2de13b3', $result->cachekey);
 }