public function testRun() { $image = Mockery::mock('Intervention\\Image\\Image', function ($mock) { $mock->shouldReceive('blur')->with('10')->once(); }); $this->assertInstanceOf('Intervention\\Image\\Image', $this->manipulator->run(RequestFactory::create('image.jpg', ['blur' => '10']), $image)); }
public function testRun() { $image = Mockery::mock('Intervention\\Image\\Image', function ($mock) { $mock->shouldReceive('width')->andReturn('200')->twice(); $mock->shouldReceive('height')->andReturn('200')->once(); $mock->shouldReceive('resize')->with('100', '100', $this->callback)->andReturn($mock)->once(); }); $this->assertInstanceOf('Intervention\\Image\\Image', $this->manipulator->run(RequestFactory::create('image.jpg', ['w' => '100']), $image)); }
public function testRun() { $image = Mockery::mock('Intervention\\Image\\Image', function ($mock) { $mock->shouldReceive('greyscale')->twice()->andReturn($mock)->shouldReceive('brightness')->with(-10)->twice()->andReturn($mock)->shouldReceive('contrast')->with(10)->twice()->andReturn($mock)->shouldReceive('colorize')->with(38, 27, 12)->once()->andReturn($mock); }); $this->assertInstanceOf('Intervention\\Image\\Image', $this->manipulator->run(RequestFactory::create('image.jpg', ['filt' => 'greyscale']), $image)); $this->assertInstanceOf('Intervention\\Image\\Image', $this->manipulator->run(RequestFactory::create('image.jpg', ['filt' => 'sepia']), $image)); $this->assertInstanceOf('Intervention\\Image\\Image', $this->manipulator->run(RequestFactory::create('image.jpg'), $image)); }
public function testHandle() { $app = Mockery::mock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'); $server = Mockery::mock('League\\Glide\\Server', function ($mock) { $mock->shouldReceive('getImageResponse')->andReturn(Mockery::mock('Symfony\\Component\\HttpFoundation\\StreamedResponse'))->once(); }); $imageServer = new ImageServer($app, $server); $request = RequestFactory::create('image.jpg', ['w' => '100']); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\StreamedResponse', $imageServer->handle($request)); }
/** * Resolve request object. * @param array $args Array of supplied arguments. * @return Request The request object. */ public function getRequest($args) { if (isset($args[0]) and $args[0] instanceof Request) { return $args[0]; } if (isset($args[0]) and is_string($args[0])) { $path = $args[0]; $params = []; if (isset($args[1]) and is_array($args[1])) { $params = $args[1]; } return RequestFactory::create($path, $params); } throw new InvalidArgumentException('Not a valid path or Request object.'); }
public function testGetSourcePathWithEncodedEntities() { $this->assertEquals('an image.jpg', $this->server->getSourcePath('an%20image.jpg')); $this->assertEquals('an image.jpg', $this->server->getSourcePath(RequestFactory::create('an%20image.jpg'))); }
public function testCreate() { $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', ResponseFactory::create($this->cache, RequestFactory::create('image.jpg'), 'image.jpg')); }
public function testRun() { $this->image->shouldReceive('crop')->with(100, 100, 0, 0)->once(); $this->assertInstanceOf('Intervention\\Image\\Image', $this->manipulator->run(RequestFactory::create('image.jpg', ['rect' => '100,100,0,0']), $this->image)); }