public function testLoad() { $loader = new DownscaleFilterLoader(); $imagine = new Imagine(); $image = $imagine->open(__DIR__ . '/../../../Fixtures/assets/square-300x300.png'); $options = array('max' => array(201, 201)); $image = $loader->load($image, $options); $size = $image->getSize(); $this->assertEquals($options['max'], array($size->getWidth(), $size->getHeight())); }
public function testItWorksSomeHow() { $loader = new DownscaleFilterLoader(); $initialSize = new Box(50, 200); $resultSize = new Box(50, 200); $image = $this->getMockImage(); $image->method('getSize')->willReturn($initialSize); $image->method('resize')->willReturnCallback(function ($box) use(&$resultSize) { $resultSize = $box; }); $loader->load($image, array('max' => array(100, 100))); return array($initialSize, $resultSize); }